PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Automatically Log-In User After Registration And Payment

  1. Hi,

    I tried searching the forums but no one seemed to have this issue. I read that you can automatically log-in the user after registration so he doesn't need to manually log-in. I tried other member's solutions but nothing worked.

    I'm working on a registration form that requires the users to pay via the Paypal plugin. Once the payment has been made, it's only then the user will be registered.

    What I want to do, is to automatically log-in the user after payment. Is there a way that I can accomplish this? Is it also possible with the PayPal Pro add-in? Because I plan to switch to it in the future.

    Thanks!

    Posted 9 years ago on Tuesday March 5, 2013 | Permalink
  2. With the PayPal Standard add-on, there is currently no way to automatically log the user in after returning from PayPal because the password is not stored.

    With the PayPal Pro add-on, you could do this because the visitor never left your site. Let us know when you switch to the PayPal Pro add-on and we can help you at that point.

    Posted 9 years ago on Tuesday March 5, 2013 | Permalink
  3. Thanks for the reply. I decided to go ahead and use the Paypal Pro addon. Can you teach me how to do it?

    Posted 9 years ago on Wednesday March 6, 2013 | Permalink
  4. There are several solutions posted in these forums.

    http://www.gravityhelp.com/forums/tags/auto-login

    I use this in my theme's functions.php:

    [php]
    add_action("gform_user_registered", "autologin", 10, 4);
    function autologin($user_id, $config, $entry, $password) {
            wp_set_auth_cookie($user_id, false, '');
    }
    Posted 9 years ago on Wednesday March 6, 2013 | Permalink