Signup form tweak?

Signup form tweak?

by Chad Outten -
Number of replies: 1
G'day Moodlers,

I've managed to add some optional user profile fields (idnumber, department, institution and phone) to the signup form for email-based self registration and force them to be mandatory at /login/signup_form.php. I then edited language strings via moodle.php for idnumber > employee number; department > classification and institution > hospital affiliation, respectively. I've also limited the username field to 6 digits. See code below and file attached.

I've tested the above tweak with moodle 1.9.9 and it seems fine, but bearing in mind, I'm programmatically challenged - can a developer reassure me know if what I've done is perfectly ok? I'm mindful that /login/signup_form.php relates /login/signup.php and user/editadvanced.php - and I haven't edit the latter 2 files. So I just need to be confident this won't cause database or upgrade issues to moodle 2.0 down the track.

Cheers, Chad

<snippet>

$mform->addElement('text', 'username', get_string('username'), 'maxlength="6" size="6"');

$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="20" size="20"');
$mform->setType('idnumber', PARAM_TEXT);
$mform->addRule('idnumber', get_string('missingidnumber'), 'required', null, 'server');

$mform->addElement('text', 'department', get_string('department'), 'maxlength="20" size="20"');
$mform->setType('department', PARAM_TEXT);
$mform->addRule('department', get_string('missingdepartment'), 'required', null, 'server');

$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="20" size="20"');
$mform->setType('institution', PARAM_TEXT);
$mform->addRule('institution', get_string('missinginstitution'), 'required', null, 'server');

$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="20"');
$mform->setType('phone1', PARAM_TEXT);
$mform->addRule('phone1', get_string('missingphone'), 'required', null, 'server');
Attachment signup.png
Average of ratings: -