Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-2380

fix: unable to share resources with course users (since sql query was using deprecated tables)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 1.9
    • Block: File_manager
    • None
    • Any
    • Easy
    • MOODLE_19_STABLE

      no users are listed on the share page. in Moodle versions 1.9.4 >> 1.9.9
      since sql query is using old and deprecated tables.

      to fix, open file file_manager/print_lib.php and change the lines:

      $sqltoexecute = "SELECT {$CFG->prefix}user.id, {$CFG->prefix}user.firstname, {$CFG->prefix}user.lastname, {$CFG->prefix}role.name
      FROM {$CFG->prefix}user, {$CFG->prefix}course_display, {$CFG->prefix}role_assignments, {$CFG->prefix}role
      WHERE (course = $id AND {$CFG->prefix}course_display.userid = {$CFG->prefix}user.id
      AND {$CFG->prefix}user.id = {$CFG->prefix}role_assignments.userid
      AND {$CFG->prefix}role_assignments.roleid = {$CFG->prefix}role.id)";

      (better, turn them into comments)

      to:
      $sqltoexecute = "SELECT u.id, u.firstname, u.lastname, r.name
      FROM {$CFG->prefix}user u
      JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
      JOIN {$CFG->prefix}role r ON ra.roleid = r.id
      JOIN {$CFG->prefix}context con ON ra.contextid = con.id
      JOIN {$CFG->prefix}course c ON c.id = con.instanceid AND con.contextlevel = 50
      WHERE r.shortname = 'student' AND c.id = {$id}";

      enjoy

            amr Amr
            nadavkav Nadav Kavalerchik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.