I'm sure someone must have had this problem and tackled it - but I haven't been able to find a solution yet.
I'm running Moodle 1.6.4 and want to implement some changes in the form fields that appear in the participants' profiles. For instance, I want to make it obligatory to fill in "institution". Plus, I'd love to add some fields.
How can that be achieved?
Any help is greatly appreciated,
Uwe
Re: How to change fields in participants' profiles / registration
It depends on whether the user is:
1. creating a new account (e-mail authentication), or
2. editing an existing profile.
In case (1), you will need to make (CAREFUL) changes to both signup_form.html and signup.php in the /login directory of your Moodle site.
In the second case, you will need to make (CAREFUL) changes to both edit.html and edit.php in the /user directory of your Moodle site.
While the following procedure applies to new 'sign-up' accounts, I would imagine that the changes to edit.html and edit.php for existing users are somewhat similar.
As an example, suppose you want to add the field 'Institution' to the sign-up form for new users, the following are the steps you would require:
1. Open the file sign_up.html using html editor that allows you to view both design and code (I use Dreamweaver).
2. Near the top of the file, you should see a PHP code block, initialising variables. In this block, include an initialiser for institution (I placed this between the $user->lastname and $user->city initialisers).
if (empty($user->institution)) {
$user->institution = "";
}
3. Further down the sign_up.html, the form fields displayed to the user appear between <tr></tr> tags. The easiest way to add a new one is to copy and paste a complete block and make changes as required; e.g.
<tr valign="top">
<td align="right">
<?php print_string("institution") ?>
:</td>
<td>
<input type="text" name="institution" size="40" value="<?php p($user->institution) ?>" alt="<?php print_string("institution") ?>" />
<?php if (!empty($err->institution)) { formerr($err->institution);} ?>
</td>
</tr>
4. Save changes and close sign_up.html.
5. Open your language file; e.g. /lang/en_utf8 and add a new language string:
$string['missinginstitution'] = 'Missing institution';
6. Save and close language file.
7. Open signup.php and find the function validate_form (near the bottom)
8. Include your new validation clause:
if (empty($user->institution)) {
$err->city = get_string("missinginstitution");
}
9. Save and close signup.php
10. Test
Re: How to change fields in participants' profiles / registration
thanks an awful lot for the detailed help. Your solution did the trick, the new registration procedure seems to work like charm.
Great
Thanks,
Uwe
Re: How to change fields in participants' profiles / registration
Re: How to change fields in participants' profiles / registration
Re: How to change fields in participants' profiles / registration
im having the same problem with moodle 1.8,
those files dont exist in the /login directory
there is only similar files suchas
index_form.html
signup.php
signup_form.php
do the same changes apply?
Re: How to change fields in participants' profiles / registration
Re: How to change fields in participants' profiles / registration
Re: How to change fields in participants' profiles / registration
Hey, ive tried the new functionality in 1.8, thought im not sure how to make it appear in the create new account form.
any ideas?
Re: How to change fields in participants' profiles / registration
Re: How to change fields in participants' profiles / registration
The help documentation isn't a great deal of help yet. I'm sure it will be super eventually but not yet.
This page looks like you are meant to be able to add fields but not take them away, is that right, or have I lost the plot entirely or is it because it isn't actually doing as intended yet?
Thanks
Re: How to change fields in participants' profiles / registration
adding repeated Institution user custom fields?
thanks in advance.
Re: How to change fields in participants' profiles / registration
Hi John,
I was wondering if you could help me. I have managed to add two new fields to the sign up form - School and State, see attached image.
The form is all working fine except when a user creates a new account the new fields are not appearing in their profile.
Do you know how to get the new fields to appear on the profile page?
Hope you can help, this has got me puzzled.
Thanks in advance
Nicola.

Re: How to change fields in participants' profiles / registration
It is still not possible. It was requested. The request is MDL-9702.
Up to now, the user who get in has to go to edit his/her personal profile and only there he/she will be requested to fill all extra fields.
Go to vote for this feature request. Maybe this will push developers.
Re: How to change fields in participants' profiles / registration
According to John McHale's post below this can be done.
I assume if the fields can be added to the form, then these fields can be transferred to the profile page?
John, please can you confirm this.
Thanks.
Re: How to change fields in participants' profiles / registration
I've now solved this.
You need to use one of the existing fields in the profile and change the name in the language file to be the same as the new field on your sign up form.
For example in the language file I've changed 'institution' to 'School/District/Organization'
Re: How to change fields in participants' profiles / registration
could you please write which language file precisely you edited?
I assume that if your Moodle installation uses different languages all respective language files will have to be edited?
Thanks in advance,
Uwe
Re: How to change fields in participants' profiles / registration
Uhm! I'm afraid that this changes must be done in all the language files... And this could be a problem when you upgrade languages if you don't use local languages packs (but if you have a lot of possible languages it is a hard work to create a local language for each)
Re: How to change fields in participants' profiles / registration
Also, some of my profile fields I want available for registration are drop down menu.
What to do?
Re: How to change fields in participants' profiles / registration
With 1.7 I used existing fields for my customized sign up and edit profile forms, but I don't know how to use this trick with 1.8.2. The edit.html and sign_up_form.html are now .php files.
The new feature proposed by harry is not enough for me:
- in sign-up form, I need my students insert their university ID code in the registration form as mandatory field (I use an existing field for it, but I need to show it in the registration form. Otherwise, my students forgot to update their profile after the registration)
- In edit profile, I need this "ID code" to be in the required group and not in "optional" (it should be showed in the standard profile view form and not in advanced form)
But NOW?
Could somebody give any guide to edit (carefully) the user/editform. php and editadvancedform.php AND login/signup_form.php to change the order or the category (requiered vs optional) were the fields are showed?
Perhaps there are a file or a table where the fields and their properties are stored. In this case I could set manually the category and the tab order of this field... (I could survive changing only the category, the order is not essential)
It sounds easy ... but I have no idea where this information is stored.
Thanks in advance,
Re: How to change fields in participants' profiles / registration
perhaps the solution is already avalaible:
http://docs.moodle.org/en/Development:Customisable_user_profiles
and
http://moodle.org/mod/forum/discuss.php?d=55814
If somebody has proved it yet, I would kindly appreciate their comments: I'm not sure if the procedures recommended in this links are easy for dummies like me

Re: How to change fields in participants' profiles / registration
Using the new "user profile fields" solve the need to edit the user/editprofile_form.php
(it is enought for me)
But don't solve the signup problem (most important to me)
Perhaps, in 1.9 is fixed if the flag signup - the field should appear on the signup page, would be activated.
But in 1.8 I couldn't found any way to mark a "new field" (or using "existing fields") to be placed in signup form.
Another thing to fix is to show the description in the signup form (not only the long name). I need to show some instructions/norms to the students in order to fill the fields correctly.
What I want to do is present this login form in 1.8.2 (this figure attached shows what I'm using in 1.7.2):

Re: How to change fields in participants' profiles / registration
Sorry Nicola,
Only getting back to Moodling today after a short lay-off!
Glad to see that you've managed to sort this out!
Regards.
Re: How to change fields in participants' profiles / registration
Could you pls tell "How to change fields in participants' profiles / registration".
Iam using moodle 1.9.5+ .
Thanks
rambabu