Update VDM.Data.UsersSubform code
This commit is contained in:
parent
e432b291f4
commit
66cf997003
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user