Elgg  Version 3.0
delete.php
Go to the documentation of this file.
1 <?php
9 // Get the user
10 $guid = (int) get_input('guid');
12  return elgg_error_response(elgg_echo('admin:user:self:delete:no'));
13 }
14 
16  return get_user($guid);
17 });
18 if (!$user || !$user->canDelete()) {
19  return elgg_error_response(elgg_echo('admin:user:delete:no'));
20 }
21 
22 $name = $user->getDisplayName();
23 $username = $user->username;
24 
26  return $user->delete();
27 });
28 if (!$deleted) {
29  return elgg_error_response(elgg_echo('admin:user:delete:no'));
30 }
31 
32 // forward to user administration if on a user's page as it no longer exists
34 if (strpos($_SERVER['HTTP_REFERER'], $username) !== false) {
35  $forward = 'admin/users/newest';
36 }
37 
38 return elgg_ok_response('', elgg_echo('admin:user:delete:yes', [$name]), $forward);
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
$deleted
Definition: delete.php:25
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
$username
Definition: delete.php:23
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
$guid
Delete a user.
Definition: delete.php:10
if(!$deleted) $forward
Definition: delete.php:33
const ELGG_SHOW_DISABLED_ENTITIES
Definition: constants.php:158
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.
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.
const REFERER
Definition: constants.php:52
if($guid===elgg_get_logged_in_user_guid()) $user
Definition: delete.php:15
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:39