This topic contains 8 reply and 7 voices, and was last updated by Alexandra 5 years, 8 months ago
Viewing 8 Posts - 1 through 8 (of 8 total)
Author Posts
May 2, 2013 at 12:58 am 3077
Alexandra Great Plugin, just wondering if there is away to have a person be automatically logged in after the complete the registration form. I want them to be able to go directly to purchasing a posting package after they register with out having to go through the login step? Thanks Dale
May 2, 2013 at 8:45 am 3083
Mike Mike

Hmm not sure if it will work with the set up you have or not but I use “remove email verification” from WPMU DEV which does the job for you. It removes the email to verify account and auto logs in users. However, I have not tested it with the front end register form of User Frontend.

May 2, 2013 at 9:00 am 3084
Tareq Hasan Tareq Hasan

[php]
// auto log in a user who has just signed up
function wpufe_auto_login_new_user( $user_id ) {
wp_set_current_user( $user_id );
wp_set_auth_cookie( $user_id, false, is_ssl() );
}
add_action( ‘user_register’, ‘wpufe_auto_login_new_user’ );
[/php]

This code should work (not tested), place it to your themes functions.php. This will login the user after registration and set the redirect url to your purchase pack page so it gets redirected to the right place.

May 6, 2013 at 2:05 pm 3221
mithandir mithandir

This is exactly what i was looking for. Working for me, thanks 🙂

May 7, 2013 at 8:33 pm 3322
studioleland studioleland

Is that SSL function required? Does it require SSL page? I have not found this successful but will keep testing.

May 7, 2013 at 8:37 pm 3324
Tareq Hasan Tareq Hasan

No, you don’t need SSL support or SSL page. It works fine without it.

August 14, 2013 at 5:45 pm 6955
jlc jlc

Hello,

I’m interested in “auto login” too, but i need to redirect users to buddypress profile so they can complete the profile. The problem is that each user have a different url,(http://example.com/members/user_example/profile/edit/group/1/) so i cannot figure out how to do this.
Can you help me with this please?

Thank you in advance!

August 14, 2013 at 11:36 pm 6975
Tareq Hasan Tareq Hasan

Here is an example of redirecting to buddypress user profile. Appending the group part to that url should do the job.

March 18, 2014 at 2:45 pm 16841
Alexandra Alexandra

Hello.

I used a code same as your’s:

function auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id,false,is_ssl());
}

add_action( ‘user_register’, ‘auto_login_new_user’ );

… but I encounter a problem with the autologin.

The page is not really reloading. The “Register” button acts with the user creation but doesn’t do the real reload of my page who is a download page. I see at top of my page the “Login” saying in fact I’m not really logged. If I do a CTRL+R at that time, that’s OK. But without refreshing the page, I’m not logged in even after the action execution.

I tried the following action to be sure to reload my page:

function auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id,false,is_ssl());
wp_redirect(get_permalink());
exit();
}

add_action( ‘user_register’, ‘auto_login_new_user’ );

… instead of the function using only wp_set_current_user and wp_set_auth_cookie and that new function hangs, as if wp_redirect and exit are not executed.

Can you please help me?

Thank you in advance!

Viewing 8 Posts - 1 through 8 (of 8 total)