Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-22884

enrol_get_users_courses() always returns empty array

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: General
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      enrol_get_users_courses() always returns an empty array due to the below. You are required to supply a user as an argument but if you do you are returned an empty array.

      if (isguestuser($userid) or !empty($userid))

      { return(array()); }

      Also, $userid seemed to be disregarded and $USER used instead. I've attached a patch that resolves both of these issues.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            andyjdavis Andrew Davis
            Tester:
            Nobody
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Nov/10