Elgg  Version 5.1
validate.php
Go to the documentation of this file.
1 <?php
6 $user_guids = (array) get_input('user_guids');
7 if (empty($user_guids)) {
8  return elgg_error_response(elgg_echo('error:missing_data'));
9 }
10 
13  'type' => 'user',
14  'guids' => $user_guids,
15  'limit' => false,
16  ]);
17  /* @var $user \ElggUser */
18  foreach ($users as $user) {
19  if ($user->isValidated()) {
20  continue;
21  }
22 
23  $user->setValidationStatus(true, 'manual');
24 
25  if ($user->isValidated() !== true) {
26  elgg_register_error_message(elgg_echo('action:user:validate:error', [$user->getDisplayName()]));
27  continue;
28  }
29 
30  elgg_register_success_message(elgg_echo('action:user:validate:success', [$user->getDisplayName()]));
31  }
32 });
33 
34 return elgg_ok_response();
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
if(empty($user_guids)) $users
Definition: ban.php:12
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_register_success_message(string|array $options)
Registers a success system message.
Definition: elgglib.php:43
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
$user_guids
Bulk validate users.
Definition: validate.php:6
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
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Definition: entities.php:504
$user
Definition: ban.php:7
elgg_register_error_message(string|array $options)
Registers a error system message.
Definition: elgglib.php:62