Elgg  Version 5.1
unban.php
Go to the documentation of this file.
1 <?php
6 $guid = (int) get_input('guid');
7 
8 return elgg_call(ELGG_SHOW_DISABLED_ENTITIES, function() use ($guid) {
10 
11  if (!$user || !$user->canEdit()) {
12  return elgg_error_response(elgg_echo('admin:user:unban:no'));
13  }
14 
15  if (!$user->unban()) {
16  return elgg_error_response(elgg_echo('admin:user:unban:no'));
17  }
18 
19  return elgg_ok_response('', elgg_echo('admin:user:unban:yes'));
20 });
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags...
Definition: elgglib.php:299
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.
$guid
Unbans a user.
Definition: unban.php:6
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
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.
const ELGG_SHOW_DISABLED_ENTITIES
Definition: constants.php:132
$user
Definition: ban.php:7
get_user(int $guid)
Elgg users Functions to manage multiple or single users in an Elgg install.
Definition: users.php:16