Elgg  Version 6.3
ban.php
Go to the documentation of this file.
1 <?php
6 $guid = (int) get_input('guid');
8 
10  return elgg_error_response(elgg_echo('admin:user:self:ban:no'));
11 }
12 
13 if (!$user || !$user->canEdit()) {
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 if (elgg_get_config('security_notify_user_ban')) {
22  // this can't be handled by the delayed notification system as it won't send notifications to banned users
23  $user->notify('ban', $user);
24 }
25 
26 return elgg_ok_response('', elgg_echo('admin:user:ban:yes'));
$user
Definition: ban.php:7
$guid
Bans a user.
Definition: ban.php:6
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
get_user(int $guid)
Elgg users Functions to manage multiple or single users in an Elgg install.
Definition: users.php:16
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
elgg_ok_response($content='', string|array $message='', ?string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_error_response(string|array $message='', string $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34