PluginProbe
User Access Manager / 2.2.0
User Access Manager v2.2.0
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
user-access-manager / src / Controller / Backend / UserObjectController.php

UserObjectController.php in User Access Manager 2.2.0, at src/Controller/Backend/UserObjectController.php

92 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * UserObjectController.php
4 *
5 * The UserObjectController class file.
6 *
7 * PHP versions 5
8 *
9 * @author Alexander Schneider <alexanderschneider85@gmail.com>
10 * @copyright 2008-2017 Alexander Schneider
11 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 * @version SVN: $id$
13 * @link http://wordpress.org/extend/plugins/user-access-manager/
14 */
15
16 declare(strict_types=1);
17
18 namespace UserAccessManager\Controller\Backend;
19
20 use UserAccessManager\Object\ObjectHandler;
21 use UserAccessManager\UserGroup\UserGroupTypeException;
22
23 /**
24 * Class UserObjectController
25 *
26 * @package UserAccessManager\Controller\Backend
27 */
28 class UserObjectController extends ObjectController
29 {
30 /**
31 * The function for the manage_users_columns filter.
32 * @param array $defaults The table headers.
33 * @return array
34 */
35 public function addUserColumnsHeader(array $defaults): array
36 {
37 $defaults[self::COLUMN_NAME] = TXT_UAM_COLUMN_USER_GROUPS;
38 return $defaults;
39 }
40
41 /**
42 * The function for the manage_users_custom_column action.
43 * @param string $return The normal return value.
44 * @param string $columnName The column name.
45 * @param integer $id The id.
46 * @return string|null
47 * @throws UserGroupTypeException
48 * @throws UserGroupTypeException
49 */
50 public function addUserColumn(string $return, string $columnName, int $id): ?string
51 {
52 if ($columnName === self::COLUMN_NAME) {
53 $this->setObjectInformation(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $id);
54 $return .= $this->getIncludeContents('UserColumn.php');
55 }
56
57 return $return;
58 }
59
60 /**
61 * The function for the edit_user_profile action.
62 * @throws UserGroupTypeException
63 */
64 public function showUserProfile()
65 {
66 $userId = $this->getRequestParameter('user_id');
67 $this->setObjectInformation(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId);
68
69 echo $this->getIncludeContents('UserProfileEditForm.php');
70 }
71
72 /**
73 * The function for the profile_update action.
74 * @param integer $userId The user id.
75 * @throws UserGroupTypeException
76 * @throws UserGroupTypeException
77 */
78 public function saveUserData(int $userId)
79 {
80 $this->saveObjectData(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId);
81 }
82
83 /**
84 * The function for the delete_user action.
85 * @param integer $userId The user id.
86 */
87 public function removeUserData(int $userId)
88 {
89 $this->removeObjectData(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId);
90 }
91 }
92