• Resolved eyewebdesign

    (@eyewebdesign)


    Hi,

    I know I can redirect users with a specific role after login with the settings of ultimate member. But how can I redirect a specific user after login? I tried the hook login_redirect but it doesn’t work, the ultimate member setting seems to overrid it.

    Kind regards
    Davy

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @eyewebdesign

    You can try the following code snippet:

    add_action( 'um_user_login', 'um_021122_user_login', 8 );
    function um_021122_user_login(){
    
        if( 123 == um_user("ID") ){ 
              wp_redirect("/custom-landing-page/"); exit;
        }
    }

    You can add the code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code. 123 is the user’s ID. You need to change the user’s ID to be redirected to a custom page.

    Regards,

    Thread Starter eyewebdesign

    (@eyewebdesign)

    Hi,

    Thanks, it redirects, but it’s to a page in the backend and the users gets redirected to wp_login… So it seems that the redirect happens before the user is logged in.

    Kind regards
    Davy

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @eyewebdesign

    Please try the updated code below:

    add_action( 'um_on_login_before_redirect', 'um_021122_user_login', 8 );
    function um_021122_user_login( $user_id ){
    
        if( 123 == $user_id  ){ 
              wp_redirect("/custom-landing-page/"); exit;
        }
    }

    Regards,

    Thread Starter eyewebdesign

    (@eyewebdesign)

    That does the trick, thanks a lot!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘redirect specific user after login’ is closed to new replies.