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

get_role_users() (lib/accesslib.php) can return duplicate IDs.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.7.3
    • None
    • Enrolments
    • None
    • MOODLE_27_STABLE

    Description

      If a user has two roles in a course and you call get_role_users method with an array containing both those role IDs, it will throw a DB error:
      'Did you remember to make the first column something unique in your call to get_records? Duplicate value 'xx' found in column 'id'.'

      This is because the SELECT DISTINCT will not separate out the two rows as the roleid is different (MySQL).
      You could group by the u.id but you may want to return both roles?..

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              skylarkelty Skylar Kelty
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: