Moodle
  1. Moodle
  2. MDL-9415

optional "user profile fields" appear empty on profile page

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.1, 1.9
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      29542

      Description

      Now that the fix MDL-9285 made user profile fields visible on user profiles (YAY), if there is an OPTIONAL (ie required=no) user profile field it will appear on every user's profile even if empty. (See the "My Moodle" field on moodle.org profiles, for example.) Can these custom-optional fields be skipped if empty, like the regular-optional fields (phone number, etc.)?

        Activity

        Hide
        Shane Elliott added a comment -

        The code was checking for NULL values in the field data. This failed as the object data is set to the default data even if the default was empty eg an empty string rather than NULL. Have now added new method is_empty() to field class - probably a bit of overkill for the two field types that currently exist but may add some flexibility to future field types.

        Fixed in CVS. Patch applied to moodle.org

        Show
        Shane Elliott added a comment - The code was checking for NULL values in the field data. This failed as the object data is set to the default data even if the default was empty eg an empty string rather than NULL. Have now added new method is_empty() to field class - probably a bit of overkill for the two field types that currently exist but may add some flexibility to future field types. Fixed in CVS. Patch applied to moodle.org

          People

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

            Dates

            • Created:
              Updated:
              Resolved: