aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-05-14 20:31:29 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-05-14 20:31:29 +0000
commitff1edc8a348780dcde12e656304309a2bd89755c (patch)
treeefae3cf93ffebf05afa21a76a08f7aa8c2f02657 /engine/lib/users.php
parent4e7fd503716d878ce2012d06c2b82aa35a988169 (diff)
downloadelgg-ff1edc8a348780dcde12e656304309a2bd89755c.tar.gz
elgg-ff1edc8a348780dcde12e656304309a2bd89755c.tar.bz2
Fixes #3456 user/default now works much like the object/<subtype> views regarding the menu
git-svn-id: http://code.elgg.org/elgg/trunk@9082 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index c16ae1176..43b6980b2 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1309,6 +1309,41 @@ function elgg_user_hover_menu($hook, $type, $return, $params) {
return $return;
}
+function elgg_users_setup_entity_menu($hook, $type, $return, $params) {
+ if (elgg_in_context('widgets')) {
+ return $return;
+ }
+
+ $entity = $params['entity'];
+ if (!elgg_instanceof($entity, 'user')) {
+ return $return;
+ }
+
+ if ($entity->isBanned()) {
+ $banned = elgg_echo('banned');
+ $options = array(
+ 'name' => 'banned',
+ 'text' => "<span>$banned</span>",
+ 'href' => false,
+ 'priority' => 0,
+ );
+ $return = array(ElggMenuItem::factory($options));
+ } else {
+ $return = array();
+ if (isset($entity->location)) {
+ $options = array(
+ 'name' => 'location',
+ 'text' => "<span>$entity->location</span>",
+ 'href' => false,
+ 'priority' => 150,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+ }
+
+ return $return;
+}
+
/**
* This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
* add and delete fields.
@@ -1529,6 +1564,8 @@ function users_init() {
// Register the user type
elgg_register_entity_type('user', '');
+ elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_users_setup_entity_menu', 501);
+
elgg_register_event_handler('create', 'user', 'user_create_hook_add_site_relationship');
}