Elgg  Version 3.0
delete.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 
13 foreach ($user_guids as $user_guid) {
14  $user = get_user($user_guid);
15  if (empty($user)) {
16  continue;
17  }
18 
19  $name = $user->getDisplayName();
20  if ($user->delete()) {
21  system_message(elgg_echo('admin:user:delete:yes', [$name]));
22  } else {
23  register_error(elgg_echo('entity:delete:fail', [$name]));
24  }
25 }
26 
28 
29 return elgg_ok_response();
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
get_user($guid)
Get a user object from a GUID.
Definition: users.php:40
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$user_guid
Validate a user.
Definition: validate.php:6
$user_guids
Bulk delete users.
Definition: delete.php:6
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.
if(empty($user_guids)) $hidden
Definition: delete.php:11
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.
access_show_hidden_entities($show_hidden)
Show or hide disabled entities.
Definition: access.php:156
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:391
if($guid===elgg_get_logged_in_user_guid()) $user
Definition: delete.php:15