Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support andrewshu

    (@andrewshu)

    Hello @t9000

    Try to use this code:

    add_action('template_redirect', 'um_custom_login_redirect');
    function um_custom_login_redirect() {
        global $post;
    	if ( um_is_core_post( $post, 'login' ) && is_user_logged_in() ) {
    		wp_redirect( um_get_core_page( 'user' ) );
    		exit();
    	}
    }

    Thank you.

    Thread Starter t9000

    (@t9000)

    Thanks. But I tried that. There is also wp_redirect( um_get_core_page( ‘account’ ) ); but neither of those is what I’m looking for. I was looking to redirect to the user to the Custom Redirect Url as specified by the user role. So the system would redirect you as if you just logged in. But I figured it out. For anyone else looking for the same behavior here is the answer:

    add_action( 'template_redirect', 'um_restrict_login_page_logged_in' );
    function um_restrict_login_page_logged_in() {
        if ( um_is_core_page('login') && is_user_logged_in() ) {
            $redirect_url = apply_filters( 'um_login_redirect_url', um_user( 'login_redirect_url' ), um_user( 'ID' ) );
            wp_redirect( $redirect_url );
        }
    }

    • This reply was modified 1 year, 1 month ago by t9000.
    Thread Starter t9000

    (@t9000)

    Closing as this code works. Hope it helps someone else.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Logged in User Redirect to Custom Redirect URL’ is closed to new replies.