php – validation email signup form buddypress

Question

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

0
mightycode Newton 6 months 2022-02-13T12:57:30-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse