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

get_user_preferences needs to read from a config file?

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Inactive
    • Affects Version/s: 1.9.4
    • Fix Version/s: None
    • Component/s: Documentation, Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      While attempting to set the "message_blocknoncontacts" preference default in Moodle code, it occured to me that default values for preferences are hard-coded whenever get_user_preferences is called (The function is defined on line 1024 in lib/moodlelib.php for reference). What I'd like to see, is the gradual move away from hard-coded preferences, and instead using a "config" file which contains the preference defaults. For example, calling get_user_preferences could look like this:

      get_user_preferences("message_blocknoncontacts", $DEFAULTS->blocknoncontacts);

      instead of this:

      get_user_preferences("message_blocknoncontacts", 0);

      I think a few people would find this VERY handy, because there are times when you want to change default Moodle options but need to hunt around for it. Plus it could pave the way for integrating this into the Roles system or the general site config or something like that.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: