Moodle
  1. Moodle
  2. MDL-14299

custom user profile fields: checkbox code available

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9.3
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      33280

      Description

      I've written code to allow the creation of checkbox fields for use in the custom user profile fields. Thanks to the structure of the user profile code, it's just a matter of adding a new directory with the appropriate files (/user/profile/fields/checkbox/), and adding a language file. There are no changes to existing code.

      Would you like to incorporate this into the standard Moodle code? I may still have cvs access (source forge username: brian-king). Or should I post it on the Moodle Modules and Plugins site?

      Thanks and regards,
      Brian

        Activity

        Hide
        Shane Elliott added a comment -

        Code looks great!

        I think there should be 2 other options when setting up the field:
        a) text to display when checked;
        b) text to display when not checked.
        I can think of possible situations where yes/no wouldn't work. The defaults could be yes/no (taken from the language files).

        Show
        Shane Elliott added a comment - Code looks great! I think there should be 2 other options when setting up the field: a) text to display when checked; b) text to display when not checked. I can think of possible situations where yes/no wouldn't work. The defaults could be yes/no (taken from the language files).
        Hide
        Brian King added a comment -

        I could add that. An alternative would be to display a disabled checkbox (so that you could see whether it was checked or not) instead of yes/no. What do you think?

        Show
        Brian King added a comment - I could add that. An alternative would be to display a disabled checkbox (so that you could see whether it was checked or not) instead of yes/no. What do you think?
        Hide
        Shane Elliott added a comment -

        Hi Brian, that sounds like a great suggestion.

        MD had a quick look at your code too and the only change he suggested was to change the checkbox in the settings to a "yes/no" option box with some text that says something like "Enabled by default" - basically to keep the interface consistent with the other options on that page.

        Show
        Shane Elliott added a comment - Hi Brian, that sounds like a great suggestion. MD had a quick look at your code too and the only change he suggested was to change the checkbox in the settings to a "yes/no" option box with some text that says something like "Enabled by default" - basically to keep the interface consistent with the other options on that page.
        Hide
        Brian King added a comment - - edited

        Hi Shane,

        I've attached the file profilefield_advcheckbox.tgz. This incoporates the change to the display of the value (disabled checkbox instead of yes/no), the suggestion from Martin, and simplifies the code by using advcheckbox instead of checkbox.

        I don't know if you want to incorporate this into core Moodle? If not I'll post in in the "plugins and modules" database.

        Thanks,
        Brian

        Show
        Brian King added a comment - - edited Hi Shane, I've attached the file profilefield_advcheckbox.tgz. This incoporates the change to the display of the value (disabled checkbox instead of yes/no), the suggestion from Martin, and simplifies the code by using advcheckbox instead of checkbox. I don't know if you want to incorporate this into core Moodle? If not I'll post in in the "plugins and modules" database. Thanks, Brian
        Hide
        Brian King added a comment -

        I just updated the code; the checkbox was not checked for new entries when checked-by-default was selected.

        Show
        Brian King added a comment - I just updated the code; the checkbox was not checked for new entries when checked-by-default was selected.
        Hide
        Brian King added a comment -

        Updated file: typo / php4 compatibility fix.

        Show
        Brian King added a comment - Updated file: typo / php4 compatibility fix.
        Hide
        Shane Elliott added a comment -

        Hi Brian,

        Sorry for taking so long to look at this. Code works beautifully. I'll submit it into CVS.

        Cheers,
        Shane.

        Show
        Shane Elliott added a comment - Hi Brian, Sorry for taking so long to look at this. Code works beautifully. I'll submit it into CVS. Cheers, Shane.
        Hide
        Shane Elliott added a comment -

        New checkbox profile type code submitted to CVS. Kudos to Brian.

        Show
        Shane Elliott added a comment - New checkbox profile type code submitted to CVS. Kudos to Brian.
        Hide
        Petr Škoda added a comment -

        reviewed, thanks

        Show
        Petr Škoda added a comment - reviewed, thanks

          People

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

            Dates

            • Created:
              Updated:
              Resolved: