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

Custom profile fields are not validated in signup form

    XMLWordPrintable

Details

    • MOODLE_23_STABLE
    • Hide

      Implement a profile_signup_fields_validation($usernew, $files) method based on the profile_fields_validation($usernew, $files) under the user/profile/lib.php, which should be called under the login/signup_form.php and would load all custom profile fields that are set to be shown at signup page, and call their validation method.

      As a bonus, implemented the profile_signup_definition_after_data(&$mform, $userid) to enable definition after data treatment for those custom profile fields.

      Patches included.

      Show
      Implement a profile_signup_fields_validation($usernew, $files) method based on the profile_fields_validation($usernew, $files) under the user/profile/lib.php, which should be called under the login/signup_form.php and would load all custom profile fields that are set to be shown at signup page, and call their validation method. As a bonus, implemented the profile_signup_definition_after_data(&$mform, $userid) to enable definition after data treatment for those custom profile fields. Patches included.

    Description

      When a new custom profile field is created under Moodle, it is possible to create some custom validation rules implementing the edit_validate_field() method.

      At "login/signup_form.php" called by "login/signup.php" page, this method is not called for those fields which are configured to be shown at signup screen, which is the expected behavior.

      Replication steps:

      1. Create a new custom profile field with some special validation behavior.
      2. Add this new custom profile field as a new user profile field under Moodle, set it as required, and set it to be shown under the signup page.
      3. Enable the signup enrolment method, and try to signup inputting some invalid values.

      Expected result: The input will not be accepted.

      Actual result: The input data will be accepted.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              luis.alcantara Luis Gustavo Mueller de Alcantara
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: