Forum Replies Created

Viewing 2 Topics - 1 through 2 (of 2 total)
Author Posts
March 18, 2014 at 2:45 pm in reply to: Auto Login After Registration 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!

February 26, 2014 at 4:35 am in reply to: WP User Frontend Error: Pleae activate your copy 15839
Alexandra Alexandra

Okay!

Found howto activate!

Topic closed!

Viewing 2 Topics - 1 through 2 (of 2 total)