Disable name requirement at signup

Disable name requirement at signup

by Éva Rácz -
Number of replies: 1
Hi, I am working on a site where we do not want first and last names be required fields (we do not need them and don't want to have to register with authorities to handle the data). In moodle 2.2, I could do it by altering login/signup.php and login/signup_form.php (the fields are not displayed and in signup.php the values are set to be the same as the username), but making similar adjustments in 3.0 doesn't work.

What I did was:
  • added at line 85 of signup.php:
    $user->firstname = $user->username;
    $user->lastname = $user->username;
  • commented out lines 63-72 of signup_form.php

Result:
the name fields do not appear at signup, but the signup procedure cannot be completed because the page complains that there are still required fields to be filled in. 

What else should be modified? Is there a better way to do this instead of tinkering with the code? (Unfortunately I'm not really familiar with php, I just edit the code and hope for the best.)

Average of ratings: -
In reply to Éva Rácz

Απάντηση: Disable name requirement at signup

by Nikos Kokkinis -

Hello Eva,


If you want make the fields not required you have to commet the line code which :

$mform->addRule($field, get_string($stringid), 'required', null, 'client');
I don't know who it is at moodle 2.2 once i am using 3.0 but in my case i have done this in some field and it work


Best,

Nikolaos