Moodle
  1. Moodle
  2. MDL-40684

Custom user fields used to restrict access incorrectly using get_string for field name

    Details

    • Testing Instructions:
      Hide

      1. Make sure conditional activities is switched on in advanced settings.
      2. Set up a custom profile field eg "asdf 001".
      3. Set up an activity/resource in a course.
      4. Restrict access based on the custom user profile field eg "asdf 001" contains "bla".
      5. Save and return to course.
      6. Ensure the condition information does not include an incorrect reference to [[asdf 001]] and the name is displayed correctly.

      Show
      1. Make sure conditional activities is switched on in advanced settings. 2. Set up a custom profile field eg "asdf 001". 3. Set up an activity/resource in a course. 4. Restrict access based on the custom user profile field eg "asdf 001" contains "bla". 5. Save and return to course. 6. Ensure the condition information does not include an incorrect reference to [ [asdf 001] ] and the name is displayed correctly.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull 2.4 Branch:
      MDL-40684_2.4
    • Rank:
      51539

      Description

      1. Make sure conditional activities is switched on in advanced settings;
      2. Set up a custom profile field eg "asdf 001";
      3. Set up an activity/resource in a course;
      4. Restrict access based on the custom user profile field eg "asdf 001" contains "bla"
      5. Save and return to course.
      6. The condition information will include an incorrect reference to [[asdf 001]]

      Code should use API to retrieve field name from the user_info_field table, not a call to get_string()

        Activity

        Show
        Shane Elliott added a comment - Simple single line fix: https://github.com/ikawhero/moodle/commit/1893ffa71928f01ee5325d8712d38ba858ae5df1
        Hide
        Michael de Raadt added a comment -

        Thanks for working on that, Shane.

        Show
        Michael de Raadt added a comment - Thanks for working on that, Shane.
        Hide
        Mark Nelson added a comment -

        Hi Shane, works like a charm. I would suggest creating separate branches for 2.4, 2.5 and master but I know you are quite busy in Beijing atm. I cherry-picked the commit cleanly on master, so there should be no issue for integrators.

        Note to integrators: please cherry-pick the commit to 2.4, 2.5 and master. Thanks!

        Show
        Mark Nelson added a comment - Hi Shane, works like a charm. I would suggest creating separate branches for 2.4, 2.5 and master but I know you are quite busy in Beijing atm. I cherry-picked the commit cleanly on master, so there should be no issue for integrators. Note to integrators: please cherry-pick the commit to 2.4, 2.5 and master. Thanks!
        Hide
        Sam Hemelryk added a comment -

        Thanks Shane! this has been integrated now.

        Show
        Sam Hemelryk added a comment - Thanks Shane! this has been integrated now.
        Hide
        Ankit Agarwal added a comment -

        works as described.
        Thanks

        Show
        Ankit Agarwal added a comment - works as described. Thanks
        Hide
        Sam Hemelryk added a comment -

        Huzzah, your code made it into Moodle. Perhaps now things are ever so slightly better!

        "The ship can't take this much pressure. Sometimes it falls apart just sitting in the hangar."
        ~ Professor Farnsworth

        Show
        Sam Hemelryk added a comment - Huzzah, your code made it into Moodle. Perhaps now things are ever so slightly better! "The ship can't take this much pressure. Sometimes it falls apart just sitting in the hangar." ~ Professor Farnsworth

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: