Completed
Push — master ( caf222...deba87 )
by Jeroen
72:32 queued 44:47
created

actions/admin/user/unban.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Unbans a user.
4
 */
5
6
$access_status = access_show_hidden_entities(true);
7
8
$guid = get_input('guid');
9
$user = get_user($guid);
0 ignored issues
show
It seems like $guid can also be of type string; however, parameter $guid of get_user() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

9
$user = get_user(/** @scrutinizer ignore-type */ $guid);
Loading history...
10
11
if (!$user || !$user->canEdit()) {
12
	access_show_hidden_entities($access_status);
13
	return elgg_error_response(elgg_echo('admin:user:unban:no'));
14
}
15
16
if (!$user->unban()) {
17
	access_show_hidden_entities($access_status);
18
	return elgg_error_response(elgg_echo('admin:user:unban:no'));
19
}
20
21
access_show_hidden_entities($access_status);
22
23
return elgg_ok_response('', elgg_echo('admin:user:unban:yes'));
24