Created
May 13, 2020 23:01
-
-
Save csaborio001/4ce922991db6c70eade356d61b48d63d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function external_user_redirect( $redirect_to, $requested_redirect_to, $user ) { | |
// Is there a user registered to check? Otherwise simply redirect. | |
if ( isset( $user->roles ) && is_array( $user->roles ) ) { | |
// Does this user belong to the internal group? | |
if ( UserManagement::is_user_internal( $user ) ) { | |
// This will redirect them to WP-Admin. | |
return $redirect_to; | |
} elseif ( ! empty( $requested_redirect_to ) ) { | |
// External User with redirect. | |
return $requested_redirect_to; | |
} else { | |
return home_url( 'dashboard' ); | |
} | |
} else { | |
return $redirect_to; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment