• Resolved miguel1876

    (@miguel1876)


    Hello,

    I am looking for a way to redirect to a specific page upon login based on a specific User Role. There are tons of codes online that do this and even plugins but none work with your plugin. I see that you have redirect settings but those apply to all users/user roles. Is there a way to do it based on a user role please?

Viewing 1 replies (of 1 total)
  • Plugin Author xootix

    (@xootix)

    Hello,

    You can use this snippet.

    add_filter( 'xoo_el_login_redirect', function( $redirect, $user ){

    $roles = $user->roles;

    if( in_array('subscriber', $roles ) ){
    $redirect = 'https://google.com';
    }

    if( in_array('customer', $roles ) ){
    $redirect = 'https://google.com';
    }

    if( in_array('admin', $roles ) ){
    $redirect = 'https://google.com';
    }

    return $redirect;

    },99, 2 );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.