Moodle
  1. Moodle
  2. MDL-26343

Display description for custom user profile fields

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Inactive
    • Affects Version/s: 1.9.10, 2.0.1
    • Fix Version/s: DEV backlog
    • Component/s: General
    • Labels:
    • Database:
      Any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      In connection to MDL-26342, this also extends help text for custom profile fields.

      A description field already exists for each custom profile field. This is never displayed to users, except during the editing of the custom field.

      The most trivial fix here is for the functions which control the display of custom fields on the profile and sign-up screens to add the description field information, in a suitably classed <div>. But this may cause problems for Moodle installations with content in that field already who don't expect it to be displayed.

      I see two options: 1) add a new text field in addition to description which would be displayed on the sign-up and profile fields; 2) add a check box which would control whether the description text should be displayed or not on the sign-up and profile fields. Neither of these options would have impact for users upgrading existing custom profile fields. Option 2 requires less database storage and less inputting by users, so is my preferred solution.

      I have a number of requests for this (for our Sept 2011 release) and am more than happy to program myself and offer a patch. If whoever triages this thinks that's OK, please assign to me and I will add to the OU development schedule over the next few months.

        Gliffy Diagrams

          Activity

          Hide
          Jenny Gray added a comment -

          There is an issue with translation here, because the description text field would need to support the multi-lang filter, and therefore be quite big in the database so big multi-lang sites like moodle.org can support all its various languages.

          Show
          Jenny Gray added a comment - There is an issue with translation here, because the description text field would need to support the multi-lang filter, and therefore be quite big in the database so big multi-lang sites like moodle.org can support all its various languages.
          Hide
          Jenny Gray added a comment -

          Some-one asked me to help them hack this for their site. We came up with the following line of code added to the edit_field_add() function:

          $mform->addElement('static', $this->field->description,' ',format_text($this->field->description));

          Show
          Jenny Gray added a comment - Some-one asked me to help them hack this for their site. We came up with the following line of code added to the edit_field_add() function: $mform->addElement('static', $this->field->description,' ',format_text($this->field->description));
          Hide
          Diane Villemure added a comment -

          I added the suggested line of code in the function edit_field_add(&$mform) [found on line 46 of /user/profile/lib.php] as per:

          function edit_field_add(&$mform)

          { print_error('mustbeoveride', 'debug', '', 'edit_field_add'); $mform->addElement('static', $this->field->description,' ',format_text($this->field->description)); }

          but nothing showed up on the signup form. I am not a programmer so I can't debug. Is this because the "$this->field->description" is not yet defined?

          Show
          Diane Villemure added a comment - I added the suggested line of code in the function edit_field_add(&$mform) [found on line 46 of /user/profile/lib.php] as per: function edit_field_add(&$mform) { print_error('mustbeoveride', 'debug', '', 'edit_field_add'); $mform->addElement('static', $this->field->description,' ',format_text($this->field->description)); } but nothing showed up on the signup form. I am not a programmer so I can't debug. Is this because the "$this->field->description" is not yet defined?
          Hide
          Diane Villemure added a comment -

          Following the lead from the "Signup form - Add Static Text" discussion (http://moodle.org/mod/forum/discuss.php?d=203321) I inserted the suggested line in the /user/profile/field/menu/field.class.php (NB: "menu" because that is the field type I want to access a description about) at line 37 (Moodle version 2.2)

          function edit_field_add(&$mform)

          { $mform->addElement('select', $this->inputname, format_string($this->field->name), $this->options); $mform->addElement('static', $this->field->description, ' ',format_text($this->field->description)); }

          and it worked. Thanks Jenny and Nano.

          Show
          Diane Villemure added a comment - Following the lead from the "Signup form - Add Static Text" discussion ( http://moodle.org/mod/forum/discuss.php?d=203321 ) I inserted the suggested line in the /user/profile/field/menu/field.class.php (NB: "menu" because that is the field type I want to access a description about) at line 37 (Moodle version 2.2) function edit_field_add(&$mform) { $mform->addElement('select', $this->inputname, format_string($this->field->name), $this->options); $mform->addElement('static', $this->field->description, ' ',format_text($this->field->description)); } and it worked. Thanks Jenny and Nano.
          Hide
          Laura Gay Majerus added a comment -

          Ideally, I would like to have the optional Help descriptions for my custom profile fields but I found this workaround and decided to give it a go. I used Jenny Gray's code to display the description text for the custom profile text input fields I'm using and it worked! Now my descriptions of the custom fields appear below each of the new text fields. I now need to clean up my descriptions of the custom fields but that's a minor issue.

          In my case, I inserted the suggested line in the /user/profile/field/text/field.class.php (NB: "text" because that is the field type I want to access a description about) at line 37 (Moodle version 2.2)

          function edit_field_add(&$mform)

          { $mform->addElement('select', $this->inputname, format_string($this->field->name), $this->options); $mform->addElement('static', $this->field->description, ' ',format_text($this->field->description)); }

          Thanks, Diane, for cross-referencing the "Signup form - Add Static Text" discussion (http://moodle.org/mod/forum/discuss.php?d=203321) and posting your exact steps.

          Thanks, Jenny for creating this workaround!

          Show
          Laura Gay Majerus added a comment - Ideally, I would like to have the optional Help descriptions for my custom profile fields but I found this workaround and decided to give it a go. I used Jenny Gray's code to display the description text for the custom profile text input fields I'm using and it worked! Now my descriptions of the custom fields appear below each of the new text fields. I now need to clean up my descriptions of the custom fields but that's a minor issue. In my case, I inserted the suggested line in the /user/profile/field/text/field.class.php (NB: "text" because that is the field type I want to access a description about) at line 37 (Moodle version 2.2) function edit_field_add(&$mform) { $mform->addElement('select', $this->inputname, format_string($this->field->name), $this->options); $mform->addElement('static', $this->field->description, ' ',format_text($this->field->description)); } Thanks, Diane, for cross-referencing the "Signup form - Add Static Text" discussion ( http://moodle.org/mod/forum/discuss.php?d=203321 ) and posting your exact steps. Thanks, Jenny for creating this workaround!
          Hide
          Marina Glancy added a comment -

          We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible.

          ==BLK2YIMP20141121==

          Show
          Marina Glancy added a comment - We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible. ==BLK2YIMP20141121==

            People

            • Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: