Required fields for user Profile

This forum post has been removed

Number of replies: 5
The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Required fields for user Profile

by eric yullu -
Picture of Testers

Hello Rolf Petersen,

you can try editing the the file in the user/editlib.php approx line 383, on
    // Moodle optional fields.

For example to make 'city number required' :

current its

$mform->addElement('text', 'city', get_string('phone1'), 'maxlength="20" size="25"');

Add:

$mform->addRule('city', $strrequired, 'required', null, 'client');


to look like:

$mform->addElement('text', 'city', get_string('phone1'), 'maxlength="20" size="25"');

$mform->addRule('city', $strrequired, 'required', null, 'client');


Average of ratings: Useful (1)
In reply to eric yullu

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Required fields for user Profile

by Just H -

Thinking a bit outside the square, and can't say I've tried it, but perhaps the associated field module (https://moodle.org/plugins/profilefield_associated) could get you the required result and wouldn't require hacking core (which as you alluded to is a bit of a pain when upgrading and should be avoided if possible).

Average of ratings: Useful (2)
In reply to Just H

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Required fields for user Profile

by Shamim Rezaie -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers Picture of Translators

The associated field plugin helps you to make the institution field mandatory, but unfortunately you cannot do anything for the city and country.