1 | <?php |
||
2 | /** |
||
3 | * Bans a user. |
||
4 | */ |
||
5 | |||
6 | $guid = (int) get_input('guid'); |
||
7 | $user = get_user($guid); |
||
8 | |||
9 | if ($guid == elgg_get_logged_in_user_guid()) { |
||
10 | return elgg_error_response(elgg_echo('admin:user:self:ban:no')); |
||
11 | } |
||
12 | |||
13 | if (!$user || !$user->canEdit()) { |
||
1 ignored issue
–
show
introduced
by
Loading history...
|
|||
14 | return elgg_error_response(elgg_echo('admin:user:ban:no')); |
||
15 | } |
||
16 | |||
17 | if (!$user->ban('banned')) { |
||
18 | return elgg_error_response(elgg_echo('admin:user:ban:no')); |
||
19 | } |
||
20 | |||
21 | return elgg_ok_response('', elgg_echo('admin:user:ban:yes')); |
||
22 |