Skip to content
Permalink
Browse files

fix(profile): moved topbar profile menu registration to profile plugin

Refs #5967
  • Loading branch information...
jdalsem committed Feb 23, 2015
1 parent 4a66b2b commit 2100c49446fbfbdd93f6bf4ba7190e1db22834a4
Showing with 29 additions and 14 deletions.
  1. +0 −14 engine/lib/users.php
  2. +29 −0 mod/profile/start.php
@@ -713,20 +713,6 @@ function users_pagesetup() {
// topbar
if ($viewer) {
elgg_register_menu_item('topbar', array(
'name' => 'profile',
'href' => $viewer->getURL(),
'text' => elgg_view('output/img', array(
'src' => $viewer->getIconURL('topbar'),
'alt' => $viewer->name,
'title' => elgg_echo('profile'),
'class' => 'elgg-border-plain elgg-transition',
)),
'priority' => 100,
'link_class' => 'elgg-topbar-avatar',
'item_class' => 'elgg-avatar elgg-avatar-topbar',
));
elgg_register_menu_item('topbar', array(
'name' => 'usersettings',
'href' => "settings/user/{$viewer->username}",
@@ -40,6 +40,8 @@ function profile_init() {
// allow admins to set default widgets for users on profiles
elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'profile_default_widgets_hook');
elgg_register_event_handler('pagesetup', 'system', 'profile_pagesetup', 50);
}
/**
@@ -174,3 +176,30 @@ function profile_default_widgets_hook($hook, $type, $return) {
return $return;
}
/**
* Sets up user-related menu items
*
* @return void
* @access private
*/
function profile_pagesetup() {
$viewer = elgg_get_logged_in_user_entity();
if (!$viewer) {
return;
}
elgg_register_menu_item('topbar', array(
'name' => 'profile',
'href' => $viewer->getURL(),
'text' => elgg_view('output/img', array(
'src' => $viewer->getIconURL('topbar'),
'alt' => $viewer->name,
'title' => elgg_echo('profile'),
'class' => 'elgg-border-plain elgg-transition',
)),
'priority' => 100,
'link_class' => 'elgg-topbar-avatar',
'item_class' => 'elgg-avatar elgg-avatar-topbar',
));
}

0 comments on commit 2100c49

Please sign in to comment.
You can’t perform that action at this time.