On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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
    • 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
      • thx Bob, this works fantastic!