1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 09:04:38 +02:00

getUsersInClass() now accepts extended user field names - just prefix those fields with "ue.".

This commit is contained in:
Cameron
2020-01-23 14:59:01 -08:00
parent c18edcac43
commit 48ae6455a4
2 changed files with 27 additions and 5 deletions

View File

@@ -1143,7 +1143,7 @@ class user_class
*
* Could potentially be verrrrryyyy slow - has to scan the whole user database at present.
* @param string $$classes - comma separated list of classes
* @param string $fields - comma separated list of fields to be returned. `user_id` is always returned as the key of the array entry
* @param string $fields - comma separated list of fields to be returned. `user_id` is always returned as the key of the array entry, prefix with 'ue.' to retrieve extended user fields.
* @param boolean $includeAncestors - if TRUE, also looks for classes in the hierarchy; otherwise checks exactly the classes passed
* @param string $orderBy - optional field name to define the order of entries in the results array
* @return array indexed by user_id, each element is an array (database row) containing the requested fields
@@ -1203,7 +1203,9 @@ class user_class
$ret = array();
$query = "SELECT user_id,{$fields} FROM `#user` WHERE ".implode(" OR ",$qry)." ORDER BY ".$orderBy;
$lj = strpos($fields,'ue.') !== false ? "LEFT JOIN `#user_extended` AS ue ON user_id = ue.user_extended_id " : "";
$query = "SELECT user_id,{$fields} FROM `#user` ".$lj." WHERE ".implode(" OR ",$qry)." ORDER BY ".$orderBy;
if ($sql->gen($query))
{
@@ -1212,6 +1214,7 @@ class user_class
$row['user_id'] = (int) $row['user_id'];
$ret[$row['user_id']] = $row;
}
}
return $ret;