aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/admin/user/unban.php40
-rw-r--r--engine/lib/admin.php1
-rw-r--r--engine/lib/entities.php14
-rw-r--r--languages/en.php4
-rw-r--r--mod/profile/views/default/profile/menu/adminlinks.php10
5 files changed, 65 insertions, 4 deletions
diff --git a/actions/admin/user/unban.php b/actions/admin/user/unban.php
new file mode 100644
index 000000000..61c62a47c
--- /dev/null
+++ b/actions/admin/user/unban.php
@@ -0,0 +1,40 @@
+<?php
+ /**
+ * Elgg ban user
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
+
+ // block non-admin users
+ admin_gatekeeper();
+
+ $access_status = access_get_show_hidden_status();
+ access_show_hidden_entities(true);
+
+ // Get the user
+ $guid = get_input('guid');
+ $obj = get_entity($guid);
+
+ if ( ($obj instanceof ElggUser) && ($obj->canEdit()))
+ {
+ // Now actually disable it
+ if ($obj->enable())
+ system_message(elgg_echo('admin:user:unban:yes'));
+ else
+ register_error(elgg_echo('admin:user:unban:no'));
+ }
+ else
+ register_error(elgg_echo('admin:user:unban:no'));
+
+ access_show_hidden_entities($access_status);
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+?> \ No newline at end of file
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index e8ec019ac..52bf3e1f1 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -46,6 +46,7 @@
extend_elgg_admin_page('admin/main_opt/plugins', 'admin/main', 999); // Always last
register_action('admin/user/ban', false, "", true);
+ register_action('admin/user/unban', false, "", true);
register_action('admin/user/delete', false, "", true);
register_action('admin/user/resetpassword', false, "", true);
register_action('admin/user/makeadmin', false, "", true);
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 31129fbad..771627b89 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -86,6 +86,7 @@
$this->attributes['access_id'] = 0;
$this->attributes['time_created'] = "";
$this->attributes['time_updated'] = "";
+ $this->attributes['enabled'] = "";
// There now follows a bit of a hack
/* Problem: To speed things up, some objects are split over several tables, this means that it requires
@@ -674,6 +675,19 @@
}
/**
+ * Is this entity enabled?
+ *
+ * @return boolean
+ */
+ public function isEnabled()
+ {
+ if ($this->enabled)
+ return true;
+
+ return false;
+ }
+
+ /**
* Delete this entity.
*/
public function delete()
diff --git a/languages/en.php b/languages/en.php
index b7df82137..92d6b6b60 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -460,7 +460,9 @@ To remove a widget drag it back to the <b>Widget gallery</b>.",
'admin:user:label:seachbutton' => "Search",
'admin:user:ban:no' => "Can not ban user",
- 'admin:user:ban:yes' => "User banned.",
+ 'admin:user:ban:yes' => "User banned.",
+ 'admin:user:unban:no' => "Can not unban user",
+ 'admin:user:unban:yes' => "User un-banned.",
'admin:user:delete:no' => "Can not delete user",
'admin:user:delete:yes' => "User deleted",
diff --git a/mod/profile/views/default/profile/menu/adminlinks.php b/mod/profile/views/default/profile/menu/adminlinks.php
index 240c8453b..f59059db8 100644
--- a/mod/profile/views/default/profile/menu/adminlinks.php
+++ b/mod/profile/views/default/profile/menu/adminlinks.php
@@ -15,9 +15,13 @@
if (isadminloggedin()){
if ($_SESSION['id']!=$vars['entity']->guid){
?>
- <p class="user_menu_admin">
- <a href="<?php echo $vars['url']; ?>actions/admin/user/ban?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("ban"); ?></a>
- <a href="<?php echo $vars['url']; ?>actions/admin/user/delete?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("delete"); ?></a>
+ <p class="user_menu_admin"><?php
+ if ($vars['entity']->isEnabled()) {
+ ?><a href="<?php echo $vars['url']; ?>actions/admin/user/ban?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("ban"); ?></a><?php
+ } else {
+ ?><a href="<?php echo $vars['url']; ?>actions/admin/user/unban?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("unban"); ?></a><?php
+ }
+ ?><a href="<?php echo $vars['url']; ?>actions/admin/user/delete?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("delete"); ?></a>
<a href="<?php echo $vars['url']; ?>actions/admin/user/resetpassword?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("resetpassword"); ?></a>
<?php if (!$vars['entity']->admin) { ?><a href="<?php echo $vars['url']; ?>actions/admin/user/makeadmin?guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("makeadmin"); ?></a> <?php } ?>
</p>