On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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">
     &outputSeparator=`<br />.......................`
    <h1>Gamers Chain members</h1>
    <p>([[+peoplegroups.userCount]] Users)</p>
    <br />

    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">
    <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?
    • Hm...idk if I get you correct...

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

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

      "People"-snippet call on resource 241:

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

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

      $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...


      Bob Ray did point me to this:


      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 5 years, 6 months ago.]
      • 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.