aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 03:17:51 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 03:17:51 +0000
commit7303fb1a0960e6bb3b6e11f51372d1ed689e3b84 (patch)
tree76e202bff895a45c5ed40dcd0020b0e49b6d8125 /engine/lib
parent72c83e4904a13c0e07d0d328ccbd201d16a617cc (diff)
downloadelgg-7303fb1a0960e6bb3b6e11f51372d1ed689e3b84.tar.gz
elgg-7303fb1a0960e6bb3b6e11f51372d1ed689e3b84.tar.bz2
added a user admin menu that plugins can add menu items to
git-svn-id: http://code.elgg.org/elgg/trunk@7678 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/users.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 0482fd034..d95f32475 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1478,6 +1478,34 @@ function user_avatar_hook($hook, $entity_type, $returnvalue, $params){
}
/**
+ * Setup the user admin menu
+ */
+function elgg_user_admin_menu($hook, $type, $return, $params) {
+ $user = $params['user'];
+
+ $actions = array();
+ if (!$user->isBanned()) {
+ $actions[] = 'ban';
+ } else {
+ $actions[] = 'unban';
+ }
+ $actions[] = 'delete';
+ $actions[] = 'resetpassword';
+ if (!$user->isAdmin()) {
+ $actions[] = 'makeadmin';
+ } else {
+ $actions[] = 'removeadmin';
+ }
+
+ foreach ($actions as $action) {
+ $url = "action/admin/user/$action?guid={$user->guid}";
+ $url = elgg_add_action_tokens_to_url($url);
+ $item = new ElggMenuItem($action, elgg_echo($action), $url);
+ elgg_register_menu_item('user_admin', $item);
+ }
+}
+
+/**
* This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
* add and delete fields.
*
@@ -1656,6 +1684,8 @@ function users_init() {
elgg_register_menu_item('page', $params);
}
+ elgg_register_plugin_hook_handler('register', 'menu:user_admin', 'elgg_user_admin_menu');
+
elgg_register_action("register", '', 'public');
elgg_register_action("useradd", '', 'public');
elgg_register_action("friends/add");