Viewing 15 replies - 1 through 15 (of 16 total)
  • Josh Harrison

    (@picklewagon)

    What other plugins do you have installed? I’m guessing another plugin is causing this behavior.

    Thread Starter wegier

    (@wegier)

    Hi Josh,

    Here is list of plugin that I use:

    CodeStyling Localization v1.99
    Contact Form 7 v3.6
    Cookie Law Info v1.1.2
    Duplicate Post Plugin v2.6
    Force Regenerate Thumbnails v2.0.3
    Revolution Slider 3.0.95
    Sidebar & Widget Manager v3.9
    The Events Calendar v3.7
    WooCommerce v2.2.6
    WooCommerce Custom Product Tabs Lite v1.2.6
    WP Migrate DB v0.6.1

    hernangalvan

    (@hernangalvan)

    Its happening to me too. After registration if user clicks on a page is auto-logged in. When i close sessino and try to do it again THEN it works correctly, but not inmediatly after registration.

    Thread Starter wegier

    (@wegier)

    So any ideas what is the problem?

    Josh Harrison

    (@picklewagon)

    This is a known issue when using the New User Approve plugin with the WooCommerce plugin. The WooCommerce plugin bypasses some core hooks that are necessary for the NUA plugin to function correctly. I am in the process of trying to figure out a solution. Sorry about the inconvenience.

    Thread Starter wegier

    (@wegier)

    Thank You for information.
    I will be keeping my fingers crossed for you to succeed in this.
    Good luck and keep notify about progress:)

    Thread Starter wegier

    (@wegier)

    Any news about working plugin with WooCommerce?

    Any work around for this? Your plugin is the newest in development that I can find, but because we’re using WooCommerce, we’re unable to use it. Would really love to get this working as we’re already live with a need for it.

    Thanks, and great work on the plugin! It looks great!

    As a workaround, I’ve added the following to my functions.php:

    add_action('woocommerce_registration_redirect', 'user_autologout', 2);
    
    /* Stop auto login */
    
    function user_autologout(){
           if ( is_user_logged_in() ) {
                    $current_user = wp_get_current_user();
                    $user_id = $current_user->ID;
                    $approved_status = get_user_meta($user_id, 'wp-approve-user', true);
                    //if the user hasn't been approved yet by WP Approve User plugin, destroy the cookie to kill the session and log them out
            if ( $approved_status == 1 ){
                return $redirect_url;
            }
                    else{
                wp_logout();
                            return get_permalink(woocommerce_get_page_id('myaccount')) . "?approved=false";
                    }
            }
    }
    add_filter('woocommerce_registration_redirect', 'user_autologout', 2);
    
    function registration_message(){
            $not_approved_message = '<p class="registration">Send in your registration application today!<br /> NOTE: Your account will be held for moderation and you will be unable to login until it is approved.</p>';
            if( isset($_REQUEST['approved']) ){
                    $approved = $_REQUEST['approved'];
                    if ($approved == 'false')  echo '<p class="registration successful">Registration successful! You will be notified upon approval of your account.</p>';
                    else echo $not_approved_message;
            }
            else echo $not_approved_message;
    }
    add_action('woocommerce_before_customer_login_form', 'registration_message', 2);

    Awesome. That is great start for me. It’s on my list to look at. Just haven’t had the chance to come up with a good solution. I’m shooting for the next version.

    Hey brandonecarr and others,

    Thanks for the piece of code! It works great.
    Could I change it somehow so it redirects to a custom thank you page?

    Hello there.

    This looks like a great solution and I was wondering if this issue was resolved in the update 3 weeks ago.

    Thanks –

    Hi everyone!

    I’m trying to mix brandonecarr’s Stop auto login code with Polylang’s function pll_the_languages in order to redirect the users to their respective language login page.

    I have 2 register pages, one in english and the other one in spanish as the main language. When an english user registers in the english version it is redirected to the spanish version of the my-account page.

    Does anyone know how could I use the if(pll_current_language()==”en”){…. to redirect english users to their respective my-account page (/en/sign-in/)?

    Thanks!

    Not sure what happened maybe an update in woocommerce or the plugin but when I add this code it crashes the site with a 500 error. When I strip the code out, site comes right back up

    This is happening with Buddypress it seems too. Trying to figure out a method with that.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘The user is auto logged in after registering’ is closed to new replies.