We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37393
    • 68 Posts
    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.
      • 3749
      • 24,544 Posts
      The Login package includes a Profile snippet that should do what you want: http://rtfm.modx.com/display/ADDON/Login.Profile
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 37393
        • 68 Posts
        I got that allready but im wondering how to do something like a member list and link to the user's profile
        As early MODX user i know that WebloginPE had a built in function like this..
        look url: bowkilled123
        i would like to use either the user id "[[+id]]" or "[[+username]]" in the url of the profile page.
        How to do this?
          IntoVPS - VPS hosting service with super-fast response.
          If MODx does not suit your needs then you have a lack of imagination.
          • 3749
          • 24,544 Posts
          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').
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 37393
            • 68 Posts
            Hi again Bob, could you give me some more ideas of building this thing?
            Lets say this stuff below is my "wished" webpage with users:

            Memberlist


            Username: bowkilled123
            View my profile


            Username: user2
            View my profile


            Username: user35
            View my profile


            This is the default code / snapped out from a paragraph in the Profile.php located at core/components/login/controllers/web
                /**
                 * Get the specified or active user
                 * @return boolean|modUser
                 */
                public function getUser() {
                    $user = $this->getProperty('user',false,'isset');
            
                    /* verify authenticated status if no user specified */
                    if (empty($user) && !$this->modx->user->hasSessionContext($this->modx->context->get('key'))) {
                        $this->user = false;
                    }
                    /* specifying a specific user, so try and get it */
                    if (!empty($user)) {
                        $username = $user;
                        $userNum = (int)$user;
                        $c = array();
                        if (!empty($userNum)) {
                            $c['id'] = $userNum;
                        } else {
                            $c['username'] = $username;
                        }
                        $this->user = $this->modx->getObject('modUser',$c);
                        if (!$this->user) {
                            $this->modx->log(modX::LOG_LEVEL_ERROR,'Could not find user: '.$username);
                            $this->user = false;
                        }
                    /* just use current user */
                    } else {
                        $this->user =& $this->modx->user;
                    }
                    return $this->user;
                }
            }
            return 'LoginProfileController';



            [ed. note: bowkilled last edited this post 14 years, 11 months ago.]
              IntoVPS - VPS hosting service with super-fast response.
              If MODx does not suit your needs then you have a lack of imagination.
              • 3749
              • 24,544 Posts
              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.]
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 37393
                • 68 Posts
                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.
                  • 3749
                  • 24,544 Posts
                  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.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 37393
                    • 68 Posts
                    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.
                      • 3749
                      • 24,544 Posts
                      My Pleasure. smiley
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting