| @@ 116-128 (lines=13) @@ | ||
| 113 | * @param integer $user_id |
|
| 114 | * @return object |
|
| 115 | */ |
|
| 116 | public function block($user_id) |
|
| 117 | { |
|
| 118 | if ( ! $this->hasGroup('Admin')) |
|
| 119 | { |
|
| 120 | \ErrorHandler::noPermissions(); |
|
| 121 | } |
|
| 122 | ||
| 123 | $user = \Core::users()->find($user_id); |
|
| 124 | $user->blocked = 1; |
|
| 125 | $user->save(); |
|
| 126 | ||
| 127 | return $user; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * Unblock the user. |
|
| @@ 136-148 (lines=13) @@ | ||
| 133 | * @param integer $user_id |
|
| 134 | * @return object |
|
| 135 | */ |
|
| 136 | public function unblock($user_id) |
|
| 137 | { |
|
| 138 | if ( ! $this->hasGroup('Admin')) |
|
| 139 | { |
|
| 140 | \ErrorHandler::noPermissions(); |
|
| 141 | } |
|
| 142 | ||
| 143 | $user = \Core::users()->find($user_id); |
|
| 144 | $user->blocked = 0; |
|
| 145 | $user->save(); |
|
| 146 | ||
| 147 | return $user; |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * Check if the user blocked or not. |
|