Moodle
  1. Moodle
  2. MDL-17151

Custom fields unique status doesn't work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.4, 2.0
    • Component/s: Administration, Usability
    • Labels:
      None
    • Environment:
      Any
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      30279

      Description

      When i was using custom fields, the Unique option didn't work. After searching some files, I got to /user/profile/lib.php , which defines custom fields class.
      There is a function

      function is_unique()
      {
      return (boolean)$tihs->field->forceunique;
      }

      which is supposed to return that field from the database.

      I thought correcting the mispelling of $this would fix the error. But i found something even stranger.
      There isn't any file using this function.

      Is the unique code done? Or left TODO?

        Activity

        Hide
        Helen Foster added a comment -

        Assigning to Shane. Hope you can help with this issue. Please feel free to reassign to Eloy if not.

        Show
        Helen Foster added a comment - Assigning to Shane. Hope you can help with this issue. Please feel free to reassign to Eloy if not.
        Hide
        Shane Elliott added a comment -

        The typo is my fault - easy enough to fix.

        Will look into the uniqueness checks.

        Show
        Shane Elliott added a comment - The typo is my fault - easy enough to fix. Will look into the uniqueness checks.
        Hide
        Shane Elliott added a comment -

        Typo fixed in CVS. Code added to base class to check for uniqueness of data. Not sure why this was never added, but it's in there now. We've tested here but be good if further testing is done.

        Thanks for raising this issue.

        As an aside, thinking while I type here, may need to add a flag for the field plugins to say whether uniqueness applies. For types like the checkbox it doesn't make sense, so it shouldn't be an option for admins to turn on.

        Show
        Shane Elliott added a comment - Typo fixed in CVS. Code added to base class to check for uniqueness of data. Not sure why this was never added, but it's in there now. We've tested here but be good if further testing is done. Thanks for raising this issue. As an aside, thinking while I type here, may need to add a flag for the field plugins to say whether uniqueness applies. For types like the checkbox it doesn't make sense, so it shouldn't be an option for admins to turn on.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Fixed DB 2.0 syntax in HEAD. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Fixed DB 2.0 syntax in HEAD. Ciao
        Hide
        Jérôme Mouneyrac added a comment -

        Tested on 1.9, it works now. Thanks everybody.

        Show
        Jérôme Mouneyrac added a comment - Tested on 1.9, it works now. Thanks everybody.
        Hide
        Jérôme Mouneyrac added a comment -

        tested on HEAD too, it also works.

        Show
        Jérôme Mouneyrac added a comment - tested on HEAD too, it also works.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: