Home Forums Plugin Support WP User Frontend Pro User registered but not logged

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  Sonia 5 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16319

    Sonia
    Member
    Post count: 5

    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 ?

    #16322

    Sonia
    Member
    Post count: 5

    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.

    #16324

    Tareq Hasan
    Keymaster
    Post count: 2831

    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/

    #16330

    Sonia
    Member
    Post count: 5

    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)

    #16340

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #17104

    Sonia
    Member
    Post count: 5

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

    Thanks !

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘User registered but not logged’ is closed to new replies.