Moodle
  1. Moodle
  2. MDL-18432

get_user_preferences needs to read from a config file?

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9.4
    • Fix Version/s: None
    • Component/s: Documentation, Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      5066

      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.

        Activity

        Hide
        Helen Foster added a comment -

        David, thanks for your report. Reassigning to lib component lead, moodle.com, for consideration.

        Show
        Helen Foster added a comment - David, thanks for your report. Reassigning to lib component lead, moodle.com, for consideration.
        Hide
        Mark Ward added a comment -

        This seems to have been a concern since Moodle 1.5 and it's still an issue in Moodle 2.0.3, being unable to change such default settings without hacking core code is not a minor problem for a production site.

        Show
        Mark Ward added a comment - This seems to have been a concern since Moodle 1.5 and it's still an issue in Moodle 2.0.3, being unable to change such default settings without hacking core code is not a minor problem for a production site.

          People

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

            Dates

            • Created:
              Updated: