validation email signup form buddypress

I try to customise the standard email validation error text from the signup form.

So I have a child theme and I have a functions.php file.

There is a file bp-members-functions.php in buddyboss.

with this function:

function bp_core_add_validation_error_messages( WP_Error $errors, $validation_results ) {
    if ( ! empty( $validation_results['invalid'] ) ) {
        $errors-add( 'user_email', __( 'Please sdfsdfsdfr a valid email address.', 'buddyboss' ) );
    }

    if ( ! empty( $validation_results['domain_banned'] ) ) {
        $errors-add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddyboss' ) );
    }

    if ( ! empty( $validation_results['domain_not_allowed'] ) ) {
        $errors-add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddyboss' ) );
    }

    if ( ! empty( $validation_results['in_use'] ) ) {
        $errors-add( 'user_email', __( 'Sorry, that email address is already used!', 'buddyboss' ) );
    }
}

So I try to override this function in the functions.php file like this:

add_action('bp_core_add_validation_error_messages', function(WP_Error $errors, $validation_results){

    $bp = buddypress();

    if ( ! empty( $validation_results['invalid'] ) ) {
        $errors-add( 'user_email', __( 'Please email.', 'buddyboss' ) );
    }
});

But nothing changed.

So what I have to change in the functions.php file?

Thank you

Topic validation buddypress Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.