We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46220
    • 66 Posts
    Hi,

    For my site I thought it was a nice idea to have a page with members using peoples. I've been trying some stuff and overall it works, but some links point to the right name, but when you click on them, they move to the general discuss forum.

    Members page: http://www.gamerschain.com/members.html

    Code used on the page:
    <div class="term-priv">
    [[
    PeopleGroup? 
     &usergroup=`gcmembers` 
     &toPlaceholder=`users` 
     &getProfile=`1` 
     &getExtended=`1` 
     &sortDir=`ASC`
     &outputSeparator=`<br />.......................`
     &active=`1`
    ]]
     
    <h1>Gamers Chain members</h1>
    <p>([[+peoplegroups.userCount]] Users)</p>
     
    <br />
    
    <ul>
    [[+users]]
    </ul>
    
    </div>

    The &getExtended is for future use.

    Chunk used:
    <li class="[[+cls]]">[[+username]] - <em>[[+role]]</em></li>
    <div class="PanelBox-avatar img">
    <img src="assets/userfiles/[[+username]]/avatar.gif">
    </div>
    <p><a href="[[+site_url]]/forums/u/[[+username]]">view profile</a></p>


    Also, for some reason you need to be logged in to view the profile page. Anyone any ideas for both issues?
      • 35756
      • 166 Posts
      Hm...idk if I get you correct...

      I'm achieving this by linking to a resource which holds the "People"-snippet:

      Chunk:
      <p><a href="[[~241]]?user=[[+id]]">">view profile</a></p>


      "People"-snippet call on resource 241:

      [[!mySession]] 
      [[!Profile? &user=`[[+user]]`]]


      The [[+user]]-placeholder is "built" in the mySession-snippet:

      <?php
      $myUserId = $_GET['user'];
      $profile = $modx->getObject('modUserProfile', array('internalKey' => $myUserId));
      
      $modx->setPlaceholder('user', $myUserId);


      This looks for the URL-variable which holds the user-id.

      Hope this helps...

      EDIT:

      Bob Ray did point me to this:

      http://forums.modx.com/thread/93111/search-in-user-extended-fields?page=2#dis-post-511685

      You should also think about the security implications, because anyone can access that page with any user ID (including yours). Putting it in a $_SESSION variable wherever you currently construct the URL would be safer:

      $_SESSION['user'] = $userId;

      So you should better try to get the $_SESSION variable set! Then I think you don't have to use the URL-variable, you have to check for the $_SESSION variable in the mySession-snippet I think...didn't try this yet, because my profile-sites are in a restricted area. [ed. note: profilneurotiker last edited this post 9 years, 6 months ago.]
        • 46220
        • 66 Posts
        I noticed I haven't responded to this yet, how rude of me. So apologies for that and thanks for your response Profilneurotiker! I'll dig into it and see if I can get it to work.