alian666
Forum Replies Created
-
Forum: Plugins
In reply to: [New User Approve] Users gain access immediately after registrationOk it doesn’t help so much if don’t use login theme, the function is now called, but you’re still logged.
So you can comment last filter (or don’t do the update I describe in my last post) and add this:add_action(‘woocommerce_created_customer’, ‘logout_if_not_approved’,10,1);
function logout_if_not_approved($user_id) {
$user_status = get_user_meta( $user_id, ‘pw_user_status’ );
if ($user_status[0] == ‘pending’) {
wp_logout();
wp_redirect(get_permalink( get_option(‘woocommerce_myaccount_page_id’)) . ‘?msg=’. urlencode(“Account need validation”),302);
exit(0);
}
}You must then catch $_GET[‘msg’] to display it after the redirect.
Forum: Plugins
In reply to: [New User Approve] Users Gaining access BEFORE approval if they don’t logoutfix for this:
l.63: Change
add_filter( ‘registration_errors’, array( $this, ‘show_user_pending_message’ ) );
To:
add_filter( ‘woocommerce_registration_errors’, array( $this, ‘show_user_pending_message’ ) );HTH
- This reply was modified 8 years, 5 months ago by alian666.
Forum: Plugins
In reply to: [New User Approve] Users gain access immediately after registrationfix for this:
l.63: Change
add_filter( ‘registration_errors’, array( $this, ‘show_user_pending_message’ ) );
To:
add_filter( ‘woocommerce_registration_errors’, array( $this, ‘show_user_pending_message’ ) );HTH
- This reply was modified 8 years, 5 months ago by alian666.