Hi, im wondering how to make a dynamic user listing, lets say we use Peoples to list the users then we use Login to make the profile of the user, now we want to view that users profile page, how can i do that? There are no built-in function for that as far as ive seen..
Would be gratefull with any answer thanks.
IntoVPS - VPS hosting service with super-fast response.
If MODx does not suit your needs then you have a lack of imagination.
The Login package includes a Profile snippet that should do what you want:
http://rtfm.modx.com/display/ADDON/Login.Profile
I'm afraid that link is dead, so I don't know exactly what you want, but you should be able to put a placeholder for the ID in the link of the Tpl chunk used by Peoples. If the link always forwards users to the same page, you could have a snippet there that grabs the $_GET parameter and sends it to the Profile snippet using $modx->runSnippet('Profile').
Here's what I'm suggesting (tested):
On the user list page:
[[Peoples? &limit=`5000` &tpl=`MyPeoplesTplChunk`]]
MyPeoplesTplChunk (replace 99 with the ID of the page that shows the profile):
<li class="[[+cls]]">[[+username]] <a href="[[~99? &userId=`[[+id]]`]]">See My Profile</a></li>
On the page that shows the profile:
[[Profile? &user=`[[!GetUserId]]`]]
<p>Username: [[+username]]</p>
<p>email: [[+email]]</p>
GetUserId snippet:
<?php
/*GetUserId snippet */
return $_GET['userId'];
Be sure both the Peoples package and the Login package are installed.
[ed. note: BobRay last edited this post 14 years, 11 months ago.]
Hi again Bob, im sorry to say that the code you posted doesnt work. But lets try get it to work, maybe there are some more hard-core modx coders here on the community forums.
Anyhow I am testing some code that i've written some hour ago. Will post it later if it works.
If we succeed with this it will become a great success because it is an improvement of an snippet that doesnt have that feature built in allready. Thanks.
IntoVPS - VPS hosting service with super-fast response.
If MODx does not suit your needs then you have a lack of imagination.
OK, fixed two minor problems. &userId in the Profile tag should be &user, and the page that shows the profile needs some placeholders to show the fields. Corrected above. It works now.
Works fantastic, great stuff Bob. Thanks for the help.
IntoVPS - VPS hosting service with super-fast response.
If MODx does not suit your needs then you have a lack of imagination.
My Pleasure.