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

Undefined variable in get_user_capability_contexts

    XMLWordPrintable

Details

    Description

      If you call get_user_capability_contexts() with $getcategories as true, and no category sort order:

      get_user_capability_contexts('tool/myplugin:viewdetails', true, false, '', '', '', '', '', 1); 

      You get undefined variable error is thrown:

      PHP Notice:  Undefined variable: orderby in /opt/homebrew/var/www/moodle/lib/accesslib.php on line 4250 

       

      This happens for categories and not courses because in the category section, we use a different variable, $orderby, to build the query, while in the course section, the original parameter variable is used - so in the empty cause, it is just used.

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              emerrill Eric Merrill
              Andrew Lyons Andrew Lyons
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              CiBoT CiBoT
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/Jun/23

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 1 minute
                  1h 1m