Elgg  Version 3.0
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 
12  $users = elgg_get_entities([
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  register_error(elgg_echo('action:user:validate:error', [$user->getDisplayName()]));
27  continue;
28  }
29 
30  system_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:1176
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$user_guids
Bulk validate users.
Definition: validate.php:6
const ELGG_SHOW_DISABLED_ENTITIES
Definition: constants.php:158
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Definition: entities.php:545
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
$user
Definition: ban.php:7
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:382
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:391