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

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

- Ian L の投稿
返信数: 3

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.

Ian L への返信

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

- 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?

tuan nghia NGUYEN への返信

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

- 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.