• Resolved BigDogSF

    (@bigdogsf)


    Hi Daniel, First off – What a great plugin!

    Been tinkering with it and will be going with some of the pro features as soon as I am clear on all of the options. Keep up the good work…this is a beautiful plugin.

    I set up a gravity form user registration form, and added the auto close popup script like this:

    <script>
    jQuery(‘#popmake-968959’).trigger(‘manualCookie’);
    setTimeout(function () {
    jQuery(‘#popmake-968959’).popmake(‘close’);
    }, 100); // 2 seconds
    </script>

    I have another function in my functions file that automatically signs in a new user after they register:

    add_action( ‘gform_user_registered’, ‘pi_gravity_registration_autologin’, 10, 4 );

    function pi_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
    $user = get_userdata( $user_id );
    $user_login = $user->user_login;
    $user_password = $password;

    wp_signon( array(
    ‘user_login’ => $user_login,
    ‘user_password’ => $user_password,
    ‘remember’ => false
    ) );
    }

    Is there a way to both close the popup upon registration submission and log the new user in?

    Regards
    Will

    https://wordpress.org/plugins/popup-maker/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @bigdogsf Glad you found the guides we have so far useful, as for your question its a tricky one. In our AJAX Login extension which includes user registration ( basic, currently no custom fields ), we offer this option as well. The catch is that the system will log them in, but in order for content on the page such as the admin bar, logged in menu items or page content to change the page must be refreshed.

    That said you could change your setTimeout function to instead of closing the popup do a window.location.reload(); This will close the popup in general as its not open when a page first loads, but also refresh page content with logged in only features.

    In our testing with AJAX login modals the page refresh often occurs so quickly that it simply appears the popup has closed. Though this depends on server speeds and user connection speeds as well.

    Hope this helps.

    PS Please take a moment to rate and review the plugin and or support.

    Thread Starter BigDogSF

    (@bigdogsf)

    Hey Daniel,
    Here’s what I place in the confirmation field of the gravity form:
    <script>
    jQuery(‘#popmake-968959’).trigger(‘manualCookie’);
    window.location.reload();
    </script>
    It works. Thanks for this so much!

    The only thing that I would like to address is a short 2-3 second delay where the top 100px of the popup window show when the chrome browser asks if I want to save the password.

    I think this is caused by the chrome browser password save feature and not anything to do with the script settings.

    However, I wanted to know if there is anything I need to add to the above script. I would greatly appreciate your feedback.

    Regards
    Will

    Plugin Author Daniel Iser

    (@danieliser)

    If you want to set a delay wrap the window.location.reload() in a setTimeout like this.

    setTimeout(function () { window.location.reload(); }, 2000);

    Change 2000 to 3000 for a 3 sec delay.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Gravity User Registration Auto Login’ is closed to new replies.