We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27106
    • 147 Posts
    I've had the same experience. It only sorts on username.
      David Walker
      Principal, Shorewalker DMS
      Phone: 03 8899 7790
      Mobile: 0407 133 020
      • 36686
      • 165 Posts
      I managed to at least get PeopleGroup to sort by [+id], but that's about it.

      I found this post about the same issue. It doesn't do any good with PeopleGroup so for me it's no good unfortunately, but if you're looking to sort Peoples it might do the trick:

      http://tracker.modx.com/issues/9752
        • 31566
        • 14 Posts
        Same issue with sorting.
        Only fields in the modUser (i.e. the modx_users table) class key are available for sorting.
        Sadly not really the most interesting ones ;-(
        Why? Because the modUserProfile class key (i.e. the modx_user_attributes table) is not queried by PeopleGroup (as far as I can see).

        Here's what I did.

        I made 2 edits in the PeopleGroup (the one with no 's') snippet.

        First, after line 59:

        /* get users */
        $c = $modx->newQuery($userClass);
        $c->innerJoin ('modUserProfile','Profile'); /* first: we add the modx_user_attributes table to the query */
        $c->innerJoin('modUserGroupMember','UserGroupMembers');


        And then after line 67:

        $c->select(array(
            'Profile.fullname',   /* then: we add fullname to the selected fields */
            'UserGroupRole.name AS role',
            'UserGroupRole.id AS role_id',
        ));


        I don't know if this is the right way to do that, but at least it works for me.

        Peoples is a really useful add-on but documentation is... short. What especially confused me was the sortByAlias property. It seems to be the way to tell the add-on to use the class key where your sortBy criteria belongs but it doesn't work (or I missed something). I first tried to pass 'Profile' or 'modUserProfile' to it, but no luck.
        So I ended with my edits in the snippet's code.