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.

gform_user_registered hook not working?

  1. I am using the User Registration plugin and would like the newly registered users to be automatically signed in after registration.

    I am trying to use the gform_user_registered hook, as well as trying WordPress's user registration hooks, but the do not seem to be firing at all.

    Posted 8 years ago on Monday May 23, 2011 | Permalink
  2. I'll have our developer who works on the User Registration Add-On reply to this when he gets a chance. It's currently after hours so he may not respond until tomorrow.

    Posted 8 years ago on Tuesday May 24, 2011 | Permalink
  3. I haven't tested this myself but in theory it should work.

    function my_auto_login( $user_id ) {
    wp_set_auth_cookie( $user_id, false, is_ssl() );
    wp_set_current_user($user_id);
    wp_redirect( admin_url( 'profile.php' ) );
    exit;
    }
    
    add_action( 'gform_user_registered', 'my_auto_login' );
    Posted 8 years ago on Tuesday May 24, 2011 | Permalink
  4. Hi Marketnetgroup,

    This response to a related support request is probably applicable to you as well:

    The issue is the the gform_user_registered hook is called too late in the process and when wp_signon attempts to create the login cookie, it generates an error. The easy fix is to set your form confirmation up to a redirect (either page or URL). When the form submission redirects, the hooks will fire sooner in the process and the wp_signon function should work.

    Let me know if you have any questions.

    Posted 8 years ago on Tuesday May 24, 2011 | Permalink