Moodle

get_course_users not working properly at site level

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 2.0
  • Component/s: Roles / Access
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

I wasn't getting anything returned with get_course_users, with a default front page role of student (it works fine if no role is assigned).

Looking at get_course_users in /lib/deprecatedlib.php, I see the following:

/// If the course id is the SITEID, we need to return all the users if the "defaultuserroleid"
/// has the capbility of accessing the site course. $CFG->nodefaultuserrolelists set to true can
/// over-rule using this.
if (($courseid == SITEID) && !empty($CFG->defaultuserroleid) && empty($CFG->nodefaultuserrolelists)) {

Should this last line be:

if (($courseid == SITEID) && empty($CFG->nodefaultuserrolelists)) {

Thanks.

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Assigning to Petr. He has been working on SITE participans recently.

Petr, that function, although deprecated... is in use in a bunch of sites. Perhaps we should clean all those usages in a separate bug?

Show
Eloy Lafuente (stronk7) added a comment - Assigning to Petr. He has been working on SITE participans recently. Petr, that function, although deprecated... is in use in a bunch of sites. Perhaps we should clean all those usages in a separate bug?
Hide
Petr Škoda (skodak) added a comment -

This was finally fixed in 2.0, the new enrolment functions return all users at the site level. No more fixing is expected in this area in 1.9.x, sorry.

Petr Škoda

Show
Petr Škoda (skodak) added a comment - This was finally fixed in 2.0, the new enrolment functions return all users at the site level. No more fixing is expected in this area in 1.9.x, sorry. Petr Škoda

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: