How to redirect user when login if role is subscriber

Hi, I’m trying to redirect an user when login if is subscriber, I’m following the auth0 documentation but I can’t make it work

function auth0_docs_hook_authorize_url_params( array $params, $connection, $redirect_to ) {
    global $user;
    if ( isset( $user->roles ) && is_array( $user->roles ) ) {

        if ( in_array( 'subscriber', $user->roles ) ) {
          $params[ 'redirect_uri' ] = 'https://example.com/subscribers';
        }
    }

    return $params;
}
add_filter( 'auth0_authorize_url_params', 'auth0_docs_hook_authorize_url_params', 10, 3 );

I don’t have idea how to do this someone have an idea? Thanks!

Hi @u4848,

Welcome to the Community!

Are you getting any errors? Is the redirect whitelisted?

Let me know,
Dan

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.