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?


    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:

    add_action( 'membership_subscription_form_after_subscriptions', 'membership_autologin' );
    function membership_autologin($user_id) {
      if($user_id && function_exists('wp_set_auth_cookie')) {

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

    Cheers, Joe



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

    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.



    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


    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


    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


We pride ourselves on our level of customer support and responsiveness to member requests. Your WordPress experience will never be the same

Start free trial