Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63068

Custom Profile Field Shortnames Getting Silently re-written

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As an admin go to Site administration -> Users -> User profile fields
      2. Create a new profile field (any type) and add a shortname with letters, numbers and underscore.
      3. Save changes
      4. Edit created profile field
      5. TEST: Check the name is the one you have just written
      6. Edit an existing field
      7. Change shortname to a new value using letters, numbers and underscore
      8. Save changes
      9. Edit created profile field
      10. TEST: Check the name is the one you have just written
      11. Create a new profile field (any type) and add a shortname with not allowed symbols such as dash (minus symbol), spaces or anything but letters, numbers or underscore.
      12. TEST: Check you are getting an error when you try to Save changes and you are not creating new field
      Show
      As an admin go to Site administration -> Users -> User profile fields Create a new profile field (any type) and add a shortname with letters, numbers and underscore. Save changes Edit created profile field TEST: Check the name is the one you have just written Edit an existing field Change shortname to a new value using letters, numbers and underscore Save changes Edit created profile field TEST: Check the name is the one you have just written Create a new profile field (any type) and add a shortname with not allowed symbols such as dash (minus symbol), spaces or anything but letters, numbers or underscore. TEST: Check you are getting an error when you try to Save changes and you are not creating new field
    • Workaround:
      Hide

      Moving shortname value validation to validate() function, and validating as 

      PARAM_ALPHANUMEXT to allow underscore apart from letters and numbers.

      Show
      Moving shortname value validation to validate() function, and validating as  PARAM_ALPHANUMEXT to allow underscore apart from letters and numbers.
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:
    • Pull Master Branch:
      MDL-63068_master

      Description

      When editing a custom profile field with a shortname that contains an underscore the underscore gets silently stripped when ever the field is edited.

      If underscores are not allowed then there should be an error, not a silent stripping, and if they are allowed they should not be stripped.

      I just spent 3 hours trying to figure out why my web services calls to create users with a field ad_dn suddenly stopped working. It was because editing the field resulted in it being renamed to addn!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amaia Amaia Anabitarte
              Reporter:
              bbusschots Bart Busschots
              Peer reviewer:
              David Mudrák (@mudrd8mz)
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Nov/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m