Sure, here's the full code for 'GetExtUsersCustom'. I commented out Bob Ray's original code, and added START and STOP comments where I added my own replacement code. I'm not an experienced PHP programmer, so no doubt it could be more elegant, but at least it works.
<?php
/**
* GetExtUsers snippet for ClassExtender extra
*
* Copyright 2012-2014 by Bob Ray <http://bobsguides.com>
* Created on 01-05-2014
*
* Customized by Karl Forsyth, 9/16/15
*
* ClassExtender is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* ClassExtender is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* ClassExtender; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package classextender
*/
/**
* Description
* -----------
* Show user information
*
* Variables
* ---------
*
* @var $modx modX
* @var $scriptProperties array
*
* @package classextender
**/
/* The extendeduser package should be pre-loaded
due to being registered in the extension_packages
System Setting */
$modx->lexicon->load('classextender:default');
/* @var $scriptProperties array */
$scriptProperties = isset($scriptProperties)
? $scriptProperties
: array();
$sp = $scriptProperties;
$userClass = $modx->getOption('userDataClass', $sp, 'userData');
$where = $modx->getOption('where', $sp, array());
$where = !empty($where)
? $modx->fromJSON($where)
: array();
/** START added by Karl */
$listGroupId = 0;
foreach($where as $key => $element) {
$keyName = 'UserGroupMembers.user_group';
$pos = strpos($key, $keyName);
if($pos !== false) {
$listGroupId = $element;
//$modx->log(modX::LOG_LEVEL_ERROR, '[GetExtUsersCustom] ' . $key . $element);
break;
}
}
$userGroupObj = $modx->GetObject('modUserGroup', array ('id'=>$element) );
$userGroupName = $userGroupObj->get('name');
//$modx->log(modX::LOG_LEVEL_ERROR, '[GetExtUsersCustom] Group name: ' . $userGroupName);
$modx->toPlaceholder('groupName',$userGroupName,'');
date_default_timezone_set("America/Los_Angeles");
$datePrinted = date("m/d/Y, g:i a");
$modx->toPlaceholder('datePrinted',$datePrinted,'');
/** END added by Karl */
$outerTpl = $modx->getOption('extUserOuterTpl', $sp, 'extUserOuterTpl');
$innerTpl = $modx->getOption('extUserInnerTpl', $sp, 'extUserInnerTpl');
$rowTpl = $modx->getOption('extUserRowTpl', $sp, 'extUserRowTpl');
$sortBy = $modx->getOption('sortby', $sp, 'username');
$sortDir = $modx->getOption('sortdir', $sp, 'ASC');
//$c = $modx->newQuery($userClass);
/** START added by Karl */
$c = $modx->newQuery('modUser');
$c->innerJoin('modUserProfile', 'Profile');
$c->innerJoin('modUserGroupMember', 'UserGroupMembers');
$c->innerJoin('userData', 'UD', 'UD.userdata_id = modUser.id');
$c->select($modx->getSelectColumns('modUser', 'modUser', '', array('id', 'username')));
$c->select($modx->getSelectColumns('userData', 'UD', 'data_'));
$c->select($modx->getSelectColumns('modUserProfile', 'Profile', 'profile_',
array('id', 'internalKey', 'fullname', 'email', 'extended')));
$c->select($modx->getSelectColumns('modUserGroupMember', 'UserGroupMembers', 'group_',
array('id', 'user_group', 'member')));
/** END added by Karl */
$c->sortby($sortBy, $sortDir);
$c->where($where);
//$users = $modx->getCollectionGraph($userClass, '{"Profile":{},"User":{}}', $c);
/** START added by Karl */
$users = $modx->getCollection('modUser', $c);
/** END added by Karl */
$count = count($users);
//$modx->log(modX::LOG_LEVEL_ERROR, '[GetExtUsersCustom] count = ' . $count);
if (!$count) {
return $modx->lexicon('ce.no_users_found');
}
/* @var $user modUser */
$i = 0;
$outer = $modx->getChunk($outerTpl);
$output = '';
$innerOutput = '';
foreach ($users as $user) {
$fields = $user->toArray();
unset($fields['password'], $fields['cachepwd'], $fields['salt'], $fields['hash_class']);
/*
if ($user->Profile) {
$fields = array_merge($user->Profile->toArray(), $fields);
}
if ($user->User) {
$fields = array_merge($user->User->toArray(), $fields);
}
*/
$inner = $modx->getChunk($innerTpl, $fields);
$row = $modx->getChunk($rowTpl, $fields);
$innerOutput .= str_replace('[[+extUserRow]]', $row, $inner);
$i++;
}
$output = str_replace('[[+extUserInner]]', $innerOutput, $outer);
return $output;