Browse Source

Fix cache issue in hook when updating user info - refs BT#15224

Angel Fernando Quiroz Campos 6 years ago
parent
commit
42d58c4fbf
1 changed files with 4 additions and 0 deletions
  1. 4 0
      main/auth/profile.php

+ 4 - 0
main/auth/profile.php

@@ -661,6 +661,10 @@ if ($form->validate()) {
     Session::write('_user', $userInfo);
 
     if ($hook) {
+        Database::getManager()->clear(User::class); //Avoid cache issue (user entity is used before)
+
+        $user = api_get_user_entity(api_get_user_id()); //Get updated user info for hook event
+
         $hook->setEventData(['user' => $user]);
         $hook->notifyUpdateUser(HOOK_EVENT_TYPE_POST);
     }