These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Bans a user. |
||
4 | * |
||
5 | * User entities are banned by setting the 'banned' column |
||
6 | * to 'yes' in the users_entity table. |
||
7 | */ |
||
8 | |||
9 | $guid = get_input('guid'); |
||
10 | $user = get_user($guid); |
||
11 | |||
12 | if ($guid == elgg_get_logged_in_user_guid()) { |
||
13 | return elgg_error_response(elgg_echo('admin:user:self:ban:no')); |
||
14 | } |
||
15 | |||
16 | if (!$user || !$user->canEdit()) { |
||
1 ignored issue
–
show
|
|||
17 | return elgg_error_response(elgg_echo('admin:user:ban:no')); |
||
18 | } |
||
19 | |||
20 | if (!$user->ban('banned')) { |
||
21 | return elgg_error_response(elgg_echo('admin:user:ban:no')); |
||
22 | } |
||
23 | |||
24 | return elgg_ok_response('', elgg_echo('admin:user:ban:yes')); |
||
25 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: