Up to 50 percent off

User registered but not logged

This topic contains 5 reply and 2 voices, and was last updated by Sonia 10 years, 8 months ago
Viewing 5 Posts - 1 through 5 (of 5 total)
Author Posts
March 9, 2014 at 3:52 pm 16319
Sonia Hi, When a new user registers, the user is created in Wordpress with all custom fields. So OK on that. But the user is not automatically logged at this stage. To be able to post, the user has to do a second action and log in. Tried with theme my login versions 6.3.8 and 6.3.9. On WPUF, override registration link is checked. It looks like there is something missing in settings somewhere. Can you please advice ?
March 9, 2014 at 6:34 pm 16322
Sonia Sonia

Hi again,

I checked previous posts for auto login after registration and added to functions.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’ );

But in this case, when registering, it keeps in an endless loop. And the user is not correctly created in its role.

March 9, 2014 at 7:18 pm 16324
Tareq Hasan Tareq Hasan

There might be some issues using this snippet in conjunction with theme my login. If you have user moderation active, it’ll try to moderate the user, while it’s being auto logged in.

For the endless loop, please refer to this video http://docs.wedevs.com/stuck-in-a-endless-loop/

March 10, 2014 at 1:17 am 16330
Sonia Sonia

Thanks for your kick answer Tareq.

In fact there was a conflict with roles editor plugin. I deactivated it and the user is properly registered (again) and no endless loop showing.

But, still with your code in functions.php, the user is not auto logged.

Maybe this code should be replaced ?

The options that are set active in TML are: “enable theme-my-login.css”, “enable e-mail address active”, “enable AJAX”, “redirection”, “user links”.

By the way, “enable e-mail address login” is active but does nothing (not recognized; error showing user is requested to enter username)

March 10, 2014 at 2:57 am 16340
Tareq Hasan Tareq Hasan

The code is fine, because it works with other users and I gave the code after testing. Maybe some illegal character was copied when copying the code? I am not sure what went wrong.

About email address login, its a TML issue. I’ll not try to solve it.

March 23, 2014 at 3:36 am 17104
Sonia Sonia

Well, at the end managed to work by deactivating everything in TML except redirection + rewriting your snippet by hand.

Thanks !

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