• Resolved makmerghen

    (@makmerghen)


    hello
    I am using option of let logged in user can find UM registration form to add new users
    I add username field and email field
    I made email field not required field
    when doing the registration it didn’t allow to continue the registration and give the next error
    “you must provide your email”
    so please advise
    best regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @makmerghen

    An email is required when creating/registering a user with UM. User Email is also required when you create a user via WP Admin > Users.

    Regards,

    Thread Starter makmerghen

    (@makmerghen)

    hello
    so only way to avoid that to do the next
    in stead of add email field and doing it optional to remove it at all from the form
    right ?

    if there are another solution to leave it in the form as option user can add it or not please let me know
    regards

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @makmerghen

    You can try this code snippet:

    add_action("um_submit_form_register","um_111121_email_field_optional", 1 );
    function um_111121_email_field_optional(){
        
        if( isset( UM()->form()->errors['user_email'] ) && UM()->form()->errors['user_email'] == "You must provide your email" ){
            if( count( UM()->form()->errors ) == 1 ){
                unset( UM()->form()->errors );
            }
            unset( UM()->form()->errors['user_email'] );
            
        }
    }

    If there’s no user email filled in the field, UM will generate a custom email address e.g. [email protected]

    Regards,

    Thread Starter makmerghen

    (@makmerghen)

    thanks a lot for helping
    best regards

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘must provide you email issue’ is closed to new replies.