Home Forums Plugin Support WP User Frontend Pro Login after registration

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  Sekander Badsha 4 years, 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26568

    Jordan
    Member
    Post count: 2

    So far the plugin is working well, but I am having trouble getting a newly registered user to be automatically logged in.

    I have this in my functions.php but doesnt seem to be changing anything

    // 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 );
    }
    add_action( 'user_register', 'wpufe_auto_login_new_user' );

    At the moment I have a successful registration redirect to the dashboard, but the user is prompted to login and if the user navigates to other pages it can get stuck in a “please login/you are already logged in” loop.

    Also the redirect on my registration form also acts as the redirect on the login page. Is there a way to seperate these two?

    Plugin conflicts does not seem to be the issue here.

    Thank you

    #26648

    Sekander Badsha
    Member
    Post count: 2067

    Hello Jordan,
    I have tested your code and it's working fine. I'm not getting any issues here. You can check if you have set any page to login. If you didn't set a page for login, please set one. I believe that would solve the redirect issue.

    #26672

    Jordan
    Member
    Post count: 2

    I am still having issues.

    Once I register I get auto redirected to the dashboard but it says,
    “This page is restricted. Please login to view this page.”

    #26775

    Sekander Badsha
    Member
    Post count: 2067

    Hello Jordan,
    This is not a feature of our add-on. So we can not provide further support regarding this.

    #26802

    Jordan
    Member
    Post count: 2

    I am not satisfied with the support I have received, and I have viewed other posts in the support forums and it seems that the support team does not try to understand people problems and instead recycle the same excuses “This is not a feature of our addon. So we can not provide further support…”, “You may want to hire a developer” etc.

    I'll try a word my issues in another way..

    After successfully registering as a new user you are not logged in. If you are on a restricted page you get an error message “This page is restricted. Please login to view this page.” Why are new users prompted to log in just after registering.

    Other people have had the same issue but seem to have solved it by adding this code:

    // 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 );
    }
    add_action( 'user_register', 'wpufe_auto_login_new_user' );

    However the function has not made a difference for me.

    Does anyone have any ideas on how this can be fixed?

    Maybe this should be added into the plugin as it is a basic feature that would save most people a bit of time on searching for fixes.

    #26823

    Sekander Badsha
    Member
    Post count: 2067

    Okay. I will forward this idea to the developer team.

    #26835

    Sekander Badsha
    Member
    Post count: 2067

    Hello Jordan,
    I have talked with @tareq regarding your issue and he asked for your Admin and FTP login credentials. Please do so in a private reply. We will have a look about what is going wrong.

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

The topic ‘Login after registration’ is closed to new replies.