“After email confirmation Admin approval” doesn’t work anymore
-
Hi, I’ve added the following code to the functions.php to enable admin approval after the email confirmation. It worked pretty well for a certain time but now it doesn’t work anymore. Can you check the code please what’s wrong? Thanks
add_action( 'um_after_email_confirmation', 'um_after_email_confirmation_admin_approval', 10, 1 );
function um_after_email_confirmation_admin_approval( $user_id ) {
um_fetch_user( $user_id );
UM()->user()->pending();
}
add_action( 'um_submit_form_errors_hook_logincheck', 'my_submit_form_errors_hook_logincheck', 10, 1 );
function my_submit_form_errors_hook_logincheck( $args ) {
$user_id = ( isset( UM()->login()->auth_id ) ) ? UM()->login()->auth_id : '';
um_fetch_user( $user_id );
$status = um_user( 'account_status' );
if( $status == 'awaiting_email_confirmation' ) {
UM()->user()->email_pending();
um_reset_user();
exit( wp_redirect( add_query_arg( 'err', esc_attr( 'awaiting_new_email_confirmation' ), UM()->permalinks()->get_current_url() ) ) );
}
}
add_filter( 'um_custom_error_message_handler', 'my_custom_error_message_handler', 999, 2 );
function my_custom_error_message_handler( $err, $error ) {
if( $error == 'awaiting_new_email_confirmation' ) {
return __( 'Your account is awaiting e-mail verification and we have now sent you a new e-mail for verification.', 'ultimate-member' );
} else {
return $err;
}
}
/**
* Custom validation and error message for the E-mail Address field.
*/
add_action( 'um_custom_field_validation_user_email_details', 'um_custom_validate_user_email_details', 999, 3 );
function um_custom_validate_user_email_details( $key, $array, $args ) {
if ( $key == 'user_email' && isset( $args['user_email'] ) ) {
if ( isset( UM()->form()->errors['user_email'] ) ) {
unset( UM()->form()->errors['user_email'] );
}
if ( empty( $args['user_email'] ) ) {
UM()->form()->add_error( 'user_email', __( 'E-mail Address is required', 'ultimate-member' ) );
} elseif ( ! is_email( $args['user_email'] ) ) {
UM()->form()->add_error( 'user_email', __( 'The email you entered is invalid', 'ultimate-member' ) );
} elseif ( email_exists( $args['user_email'] ) ) {
UM()->form()->add_error( 'user_email', __( 'The email you entered is already registered', 'ultimate-member' ) );
}
}
}
/**
* Doubled validation and error message for the E-mail Address field.
*/
add_action( 'um_submit_form_errors_hook', 'confirm_user_email_textbox', 100, 1 );
function confirm_user_email_textbox( $args ){
if ( isset( $args['user_email'] ) && isset( $args['confirm_user_email'] ) && $args['confirm_user_email'] != $args['user_email'] ) {
UM()->form()->add_error( 'user_email', 'Your email addresses are different' );
UM()->form()->add_error( 'confirm_user_email', 'Your email addresses are different' );
}
}
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- You must be logged in to reply to this topic.