dev #8
@ -15,6 +15,7 @@ class UsersSubform << (F,LightGreen) >> #RoyalBlue {
|
||||
# Items $items
|
||||
# string $table
|
||||
# array $user
|
||||
# User $identity
|
||||
# array $activeUsers
|
||||
+ __construct(Items $items, ?string $table = null)
|
||||
+ table(string $table) : self
|
||||
|
@ -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) {
|
||||
|
@ -1,17 +1,11 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"description": "CRUD the user data of any sub-form to another view (table)\r\n\r\n@since 5.0.2",
|
||||
"extends": "",
|
||||
"extendsinterfaces": null,
|
||||
"extendsinterfaces_custom": "",
|
||||
"guid": "46b98346-ec98-42b3-a393-96c7d1282b1c",
|
||||
"implements": [
|
||||
"576685fd-263c-46bb-9fdc-1f5eb234cbb6",
|
||||
"34959721-415b-4b5e-8002-3d1fc84b3b2b"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "UsersSubform",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.Data.UsersSubform",
|
||||
"type": "final class",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\User\\User;",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "7212e4db-371f-4cfd-8122-32e9bb100d83",
|
||||
@ -34,10 +28,17 @@
|
||||
"as": "Component"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
"implements": [
|
||||
"576685fd-263c-46bb-9fdc-1f5eb234cbb6",
|
||||
"34959721-415b-4b5e-8002-3d1fc84b3b2b"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "UsersSubform",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.Data.UsersSubform",
|
||||
"type": "final class",
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Data.UsersSubform",
|
||||
"description": "CRUD the user data of any sub-form to another view (table)\r\n\r\n@since 5.0.2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\User\\User;",
|
||||
"composer": ""
|
||||
"composer": "",
|
||||
"add_licensing_template": "2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n"
|
||||
}
|
Loading…
Reference in New Issue
Block a user