diff --git a/src/46b98346-ec98-42b3-a393-96c7d1282b1c/code.power b/src/46b98346-ec98-42b3-a393-96c7d1282b1c/code.power index 07a1144..7524d48 100644 --- a/src/46b98346-ec98-42b3-a393-96c7d1282b1c/code.power +++ b/src/46b98346-ec98-42b3-a393-96c7d1282b1c/code.power @@ -29,6 +29,14 @@ */ protected array $user; + /** + * The current active user + * + * @var User + * @since 5.0.2 + */ + protected User $identity; + /** * The active users * @@ -53,6 +61,8 @@ $this->table = $table; } + $this->identity = Factory::getApplication()->getIdentity(); + // Retrieve the user properties $this->initializeUserProperties(); } @@ -397,8 +407,12 @@ { $user = $this->loadUser($item, $activeUsers); $details = $this->extractUserDetails($item, $user); - $this->assignUserGroups($details, $user, $item); - + + if ($this->identity->id != $user->id) + { + $this->assignUserGroups($details, $user, $item); + } + return $this->saveUserDetails($details, $details['id'] ?? 0); } @@ -503,7 +517,7 @@ private function saveUserDetails(array $details, int $userId): int { try { - return UserHelper::save($details); + return UserHelper::save($details, 0, ['useractivation' => 0, 'sendpassword' => 1, 'allowUserRegistration' => 1]); } catch (NoUserIdFoundException $e) { Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } catch (\Exception $e) {