I was hoping something like this would work. I would like to be able to exclude certain user from authenticating via the configured oAuth path and just authenticate against the default WordPress system. Any way to do that?
Here’s some code I was hoping would work but no bueno…
function exclude_users_from_oauth_authentication($user_authenticated, $user_info) {
// Define an array of usernames to exclude
$excluded_usernames = array(‘user1’, ‘user2’, ‘user3’);
// Get the username of the user being authenticated
$username = $user_info->user_login;
// Check if the user’s username is in the excluded list
if (in_array($username, $excluded_usernames)) {
// User is excluded from OAuth authentication
return true;
}
// Allow authentication for all other users
return $user_authenticated;
}
// Hook into the miniOrange OAuth authentication process
add_filter(‘mo_oauth_check_user’, ‘exclude_users_from_oauth_authentication’, 10, 2);