Users not auto login after payment

Is there a way to ensure the users are automatically logged in after redirected back to my site frm paypal?

    aecnu

    Greetings Becky,

    I believe the correct answer to this issue or more accurately feature would be to paste the below code snippet into your themes functions.php file:

    <?php
    add_action( 'membership_subscription_form_after_subscriptions', 'membership_autologin' );
    
    function membership_autologin($user_id) {
      if($user_id && function_exists('wp_set_auth_cookie')) {
        wp_set_auth_cookie($user_id);
      }
    }
    
    ?>

    Please advise if this does the trick for you or not.

    Cheers, Joe :-)

    KevinDLyons
    • 45
    • #2,653

    Joe,

    I'm experiencing a similar problem but mine is related to Authorize.net.

    I tried adding the code but it didn't work. It's possible that mine is a different issue as the payment gets processed but the page does not refresh.

    Kevin

    becky

    By adding these codes will it cause more spam?

    aecnu

    Greetings Becky,

    Great question concerning spam!

    You have a spam problem?

    This is something I have not experienced on our sites but we use captcha in one form or another.

    Though the topic of spam is not related to this particular ticket, how are they getting away with spamming your site? What is the nature of the spam?

    Please advise.

    Cheers, Joe :-)

    becky

    Hi aecnu,

    I don't have a spam problem. I use htaccess and various plugins to block spam. I am just wondering if I add these codes, will this bypass the security checks in place.

    Let me set up a test box and give it a try this weekend. Will report back

    aecnu

    Greetings Becky,

    I do not think it will bypass the security functions.

    However, I certainly do look forward to hearing about the results from your testing.

    Cheers, Joe :-)

    aecnu

    Greetings Becky,

    Just checking if this issue was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, happy days, glad you got it sorted :)

    Thank you for being a WPMU Dev member!

    Cheers, Joe :-)

Join 371055 happy members

Get access to our entire collection of epic plugins, astonishing themes & genius support

Become a member