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.

Automatic activate and login user

  1. skot1708
    Member

    Hey there,

    for now if a user registers his status is "pending". It would be great if I could register, activate and login user at once, perfect it would be to realize this without an email requirement.

    Any Solutions?

    Thank you in advance
    Best
    Sascha

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  2. Sascha, the user is only registered as 'pending' if you have enabled user activation. If you don't use that (checkbox on the User Registration feed settings for your form) there is no activation required. Does that solve your problem?

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  3. skot1708
    Member

    Sometimes solutions are so simple...i'm sorry!

    Many Thanks, works as I expected

    Best

    Sascha

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  4. skot1708
    Member

    Ok my Problem seems to be a bit diffcult:

    The User workflow should be:
    A three page form:

    1 Page. User registration a) Using gravity Forms b) Connect with Facebook

    if b) the user gets automatic registered and logged in <--- works fine
    issue: A logged in User has to fill the gravity form fields again

    if a) The user should be automatic logged in by clicking the next button. I assume this will not work?
    Any other Ideas for this? I tried a snipped from the forum for the function.php , no luck with that.

    2 Page. User could select Events he likes to join <--- works fine

    3 Page. User could publish a post with his username, the content is presented via the "shortcode to posts" plugin <--- works fine

    So the main Problem of the workflow is to log in the user and to present a "logged in" status if the user is loged in at the first page.

    Any ideas?

    Thanks

    Sascha

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  5. So, your main issue now is that you want to log the user in automatically at some point?

    What code did you try use?

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  6. skot1708
    Member

    I used this for the function.php

    add_action( 'gform_user_registered', 'pi_gravity_registration_autologin', 10, 4 );
    /**
     * Auto login after registration.
     */
    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
        ) );
    }
    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  7. skot1708
    Member

    I uploaded the site @ http://www.generationlounge.de

    Site is still in progress and not finished. You could see two forms there,
    one for the Event registration, with a registerfield at top and the second for a frontend posting.

    I want to merge this two forms cause it might be a bit confusing for the user

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  8. It sounds like we're attempting to tackle several issues at once, which means none of them may get the attention they require.

    So, let's work on the auto login. What form can I use where your auto login function should run, so we can see if we can figure out why that is not working?

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  9. skot1708
    Member

    Ok there's only one registration form left. It's on top of the "event" page, required fields are username and email after the user submits(Anmelden) the form, the user should be auto logged in. I deleted the snipped inside the function.php so we start from 0.

    Thanks

    Edit: Ok you can have a look, I fixed everything

    Posted 7 years ago on Wednesday January 16, 2013 | Permalink
  10. Looks like nice work. Are all your issues resolved now?

    Posted 7 years ago on Thursday January 17, 2013 | Permalink
  11. skot1708
    Member

    No. I'm still not able to login and register user at once. The code snippet for the function.php I've posted doesn't work.

    If you could help me with that, this would be great.

    Thanks

    Sascha

    Posted 7 years ago on Thursday January 17, 2013 | Permalink
  12. skot1708
    Member

    So any workarounds?

    I'm sorry I have a bit timepressure getting this work. For normal I'm a very patient person ;)

    Regards

    Posted 7 years ago on Friday January 18, 2013 | Permalink
  13. Autologging in the user will be a WordPress function. You can run it at the correct time using a Gravity Forms hook. You need to find a function which works for you, and once you find one that works, we will help you integrate it with Gravity Forms.

    Posted 7 years ago on Tuesday January 22, 2013 | Permalink
  14. I just looked at a site of mine where I implemented auto-login after registration with the User Registration add-on. I added this to 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, '');
    }

    That was in conjunction with this topic:
    http://www.gravityhelp.com/forums/topic/form-direct-to-private-page-with-auto-login#post-97328

    Posted 7 years ago on Wednesday January 23, 2013 | Permalink