Skip to content
Permalink
Browse files

merged fix for MLD-7544, hidden users show up on participants block

  • Loading branch information...
toyomoyo
toyomoyo committed Apr 23, 2007
1 parent 1ba1b39 commit a1f5b4ae033ca2f0eab1ccf6c248b9a79f1f94cf
Showing with 22 additions and 2 deletions.
  1. +22 −2 blocks/online_users/block_online_users.php
@@ -1,4 +1,4 @@
<?PHP //$Id$
<?php //$Id$
/**
* This block needs to be reworked.
@@ -74,9 +74,29 @@ function get_content() {
$timeselect
$groupselect
ORDER BY ul.timeaccess DESC";
$pcontext = get_related_contexts_string($context);
if ($pusers = get_records_sql($SQL, 0, 50)) { // We'll just take the most recent 50 maximum
foreach ($pusers as $puser) {
// if current user can't view hidden role assignment in this context and
// user has a hidden role assigned at this context or any parent contexts,
// ignore this user
$SQL = "SELECT id,id FROM {$CFG->prefix}role_assignments
WHERE userid = $puser->id
AND contextid $pcontext
AND hidden = 1";
if (!has_capability('moodle/role:viewhiddenassigns', $context) && record_exists_sql($SQL)) {
// can't see this user as the current user has no capability
// and this user has a hidden assignment at this context or higher
continue;
}
$puser->fullname = fullname($puser);
$users[$puser->id] = $puser;
}

0 comments on commit a1f5b4a

Please sign in to comment.
You can’t perform that action at this time.