From 07552d51d47e51e236482f226a8ec0f689b197e7 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Wed, 20 Oct 2021 10:54:57 +0100 Subject: [PATCH] fix bug when processing sync of preferred name field --- classes/feature/usersync/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/feature/usersync/main.php b/classes/feature/usersync/main.php index 1190c5c4a..1a21af8ed 100644 --- a/classes/feature/usersync/main.php +++ b/classes/feature/usersync/main.php @@ -533,7 +533,7 @@ public static function apply_configured_fieldmap(array $aaddata, \stdClass $user $user->$localfield = $usersync->get_user_roles($userobjectid); } else if ($remotefield == "preferredName") { if (!isset($aaddata[$remotefield])) { - if (stripos($user->username, '_ext_') !== false) { + if (stripos($aaddata['userPrincipalName'], '_ext_') !== false) { $user->$localfield = $usersync->get_preferred_name($userobjectid); } }