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

    i’m trying to use Peoples.PeopleGroup snippet to display list of users on front end with my own userTpl chunk.

    In documentation, i don’t understand how to use placeholders to display all user’s fields (extended or not) in its profile

    Could somebody help me ?
    Is there another solution ? write my own snippet ?

    Thanks a lot
    Manu
      Manu
      • 3749
      • 24,544 Posts
      It looks like that snippet sets all user and profile fields, but not any extended fields (it would be a nice feature request).

      I think you’d have to use a custom snippet. I would duplicate the PeopleGroup snippet and modify it to include the extended fields. Off the top of my head:

      Change:

      if ($getProfile) {
              $profile = $user->getOne($profileAlias);
              if ($profile) $userArray = array_merge($profile->toArray(),$userArray);
      }
      


      to

      if ($getProfile) {
              $profile = $user->getOne($profileAlias);
              if ($profile) $userArray = array_merge($profile->toArray(),$userArray);
      }
      
      if ($getExtended && $profile) {
          $extended = $profile->get('extended');
          $userArray = array_merge($extended, $userArray);
      }
      


      If that works, you can include the code in the feature request. wink


      Note that you’d need both &getProfile=`1` and &getExtended=`1` in the snippet tag.

      Then you could put any user placeholders you want from the profile or extended fields in the Tpl chunk.
        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
        • 35756
        • 166 Posts
        thx Bob, this works fantastic!