Elgg  Version 1.9
delete.php
Go to the documentation of this file.
1 <?php
12 // Get the user
13 $guid = get_input('guid');
15 
17  register_error(elgg_echo('admin:user:self:delete:no'));
19 }
20 
21 $name = $user->name;
22 $username = $user->username;
23 
24 if (($user instanceof ElggUser) && ($user->canEdit())) {
25  if ($user->delete()) {
26  system_message(elgg_echo('admin:user:delete:yes', array($name)));
27  } else {
28  register_error(elgg_echo('admin:user:delete:no'));
29  }
30 } else {
31  register_error(elgg_echo('admin:user:delete:no'));
32 }
33 
34 // forward to user administration if on a user's page as it no longer exists
36 if (strpos($_SERVER['HTTP_REFERER'], $username) != FALSE) {
37  $forward = "admin/users/newest";
38 }
39 
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$username
Definition: delete.php:22
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
$guid
Definition: delete.php:13
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
const REFERER
Definition: elgglib.php:2162
$forward
Definition: delete.php:35
$user
Definition: delete.php:14
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604