MDL-13043 get_users_listing() always returned the guest account, which was then used in the user count on this page. I made this inclusion conditional, and the bug disappeared.

This commit is contained in:
nicolasconnault
2008-01-25 15:56:51 +00:00
parent 1c1b5fc676
commit 123dcabe68
+6 -1
View File
@@ -266,12 +266,13 @@ function get_users($get=true, $search='', $confirmed=false, $exceptions='', $sor
* @param string $search ?
* @param string $firstinitial ?
* @param string $lastinitial ?
* @param bool $includeguest By default, returns the guest user account as well. If set to false, it will not be returned.
* @returnobject {@link $USER} records
* @todo Finish documenting this function
*/
function get_users_listing($sort='lastaccess', $dir='ASC', $page=0, $recordsperpage=0,
$search='', $firstinitial='', $lastinitial='', $remotewhere='') {
$search='', $firstinitial='', $lastinitial='', $remotewhere='', $includeguest=true) {
global $CFG;
@@ -280,6 +281,10 @@ function get_users_listing($sort='lastaccess', $dir='ASC', $page=0, $recordsperp
$select = "deleted <> '1'";
if (!$includeguest) {
$select .= ' AND username <> \'guest\'';
}
if (!empty($search)) {
$search = trim($search);
$select .= " AND ($fullname $LIKE '%$search%' OR email $LIKE '%$search%') ";