• Resolved Manu-PB

    (@manu-pb)


    Hi,

    In the past, prior to WP v4, I used to deactivate the empty_email error notification with a function like :

    add_action( 'user_profile_update_errors', 'remove_empty_email_error' );
    function remove_empty_email_error( $arg ) {
        if ( !empty( $arg->errors['empty_email'] ) ) unset( $arg->errors['empty_email'] );
    }

    Now, with 4.0.1 or 4.1, this does not work any more, though hook [user_profile_update_errors] nor function [edit_user()} have not been modified.

    Can you help me?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Manu-PB

    (@manu-pb)

    [Edit] Now the $error array is set to “private”, which means that the previous hook must be changed.

    I managed to detect if the [error:private] entry is empty or not :

    function remove_empty_email_error( $arg ) {
        $errors = $arg->__get( 'errors' );
        if ( $errors['empty_email'] ) ...

    I can then unset ’empty_email’ from $errors, but I do not know how to unset the ’empty_email’ field in this private $arg array.

    Please help!

    Thread Starter Manu-PB

    (@manu-pb)

    I got it!
    The answer is in the WP_error class description.

    add_action( 'user_profile_update_errors', 'remove_empty_email_error' );
    function remove_empty_email_error( $arg ) {
    	$arg->remove('empty_email');
    }

    Enjoy!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Edit user without email (empty_email error)’ is closed to new replies.