Skip to content

Commit

Permalink
MDL-13043 get_users_listing() always returned the guest account, whic…
Browse files Browse the repository at this point in the history
…h was then used in the user count on this page. I made this inclusion conditional, and the bug disappeared.
  • Loading branch information
nicolasconnault committed Jan 25, 2008
1 parent 1c1b5fc commit 123dcab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/datalib.php
Expand Up @@ -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;

Expand All @@ -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%') ";
Expand Down

0 comments on commit 123dcab

Please sign in to comment.