How to remove email (again) field from sign up page?

How to remove email (again) field from sign up page?

by Ian L -
Number of replies: 5

I want to remove the second email field. How can I do this? I did a bunch of searching but nothing in regards to this. 

On old 2.7.

Average of ratings: -
In reply to Ian L

Re: How to remove email (again) field from sign up page?

by Ian L -

I tried commenting out the lines in signup_form.php but there has to be another place as that took it but didn't work.

In reply to Ian L

Re: How to remove email (again) field from sign up page?

by Ian L -

I seem to have done it>

I removed this line:

if (empty($data['email2'])) {

            $errors['email2'] = get_string('missingemail');


        } else if ($data['email2'] != $data['email']) {

            $errors['email2'] = get_string('invalidemail');

        }

And commented out:

// $mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"');

        // $mform->setType('email2', PARAM_NOTAGS);

        // $mform->addRule('email2', get_string('missingemail'), 'required', null, 'server');

Now it's more user friendly.

In reply to Ian L

Trả lời: Re: How to remove email (again) field from sign up page?

by tuan nghia NGUYEN -

Hi Ian

I have a same problem ,but my moodle is 3.4 , I tried to change signup_form.php

by comment out there lines

//$mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"');
        //$mform->setType('email2', core_user::get_property_type('email'));
        //$mform->addRule('email2', get_string('missingemail'), 'required', null, 'client');
       // $mform->setForceLtr('email2');

 The email (again) field is removed but it make user can't signup .Do you have any idea?

In reply to tuan nghia NGUYEN

Re: Trả lời: Re: How to remove email (again) field from sign up page?

by Nitesh Kumar -

Hi Tuan,


Go to lib/authlib.php file and find the signup_validate_data() function and comment the code.

    if (empty($data['email2'])) {

        $errors['email2'] = get_string('missingemail');


    } else if ($data['email2'] != $data['email']) {

        $errors['email2'] = get_string('invalidemail');

    }


Thanks.

Average of ratings: Useful (1)
In reply to Nitesh Kumar

Trả lời: Re: Trả lời: Re: How to remove email (again) field from sign up page?

by tuan nghia NGUYEN -

Thank you so muck Nitesh , It's work !!