Put more fields in Signup Form

Put more fields in Signup Form

by Nikos Kokkinis -
Number of replies: 0

Hello

I would like to put some more field in my moodle website sign up Form. Example


        $mform->addElement('text', 'schoolURL', get_string('User_info_form_school_url', 'user'), 'maxlength="100"');

        $mform->setType('schoolURL', PARAM_NOTAGS);

        $mform->addRule('schoolURL', get_string('User_info_form_schoolURL_empty_error', 'user'), 'required', null, 'server');


        $dateOptions = array('startyear' => 1990, 'stopyear' => date("Y")+2, 'timezone' => 99, 'optional' => false);

        $mform->addElement('date_selector', 'schoolVisitDate', get_string('User_info_form_school_visit_date', 'user'), $dateOptions);

        $mform->addRule('schoolStartDate', get_string('User_info_form_date_empty_error', 'user'), 'required', null, 'server');



With this code i can see the two new field in the signup form and also it take the values because  i create a cohort group with those values. 

My problem now is when i go at the page "/user/editadvanced.php" which you edit the user i see those field values empty.

I have make in DB two new columns in the user table. Also i change from the DB the values(manually) just to see if the problem was with the insert query. But again i see those values empty.


I know i could put those field in "other field" values but i would prefer with this way because i had make form for each role (Student-teacher-manager)with different URL  so all the user will have the same form which i don't want.








Average of ratings: -