Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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 
$username
Definition: delete.php:22
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
$guid
Definition: delete.php:13
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
const REFERER
Definition: elgglib.php:2029
$forward
Definition: delete.php:35
$user
Definition: delete.php:14
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
system_message($message)
Display a system message on next page load.
Definition: elgglib.php:438
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:204