aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/admin.php7
-rw-r--r--engine/lib/users.php40
-rw-r--r--views/default/page/elements/topbar.php47
3 files changed, 43 insertions, 51 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 1c78ce210..81403a6be 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -210,6 +210,13 @@ function admin_init() {
'weight' => 10,
));
+ elgg_register_menu_item('topbar_alt', array(
+ 'name' => 'administration',
+ 'href' => 'pg/admin',
+ 'text' => elgg_view_icon('settings') . elgg_echo('admin'),
+ 'weight' => 100,
+ ));
+
// widgets
$widgets = array('online_users', 'new_users', 'content_stats');
foreach ($widgets as $widget) {
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 1ac87e7d1..cf50c7ae2 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1508,20 +1508,48 @@ function users_init() {
$user = elgg_get_logged_in_user_entity();
if ($user) {
- $params = array(
+ elgg_register_menu_item('page', array(
'name' => 'edit_avatar',
'href' => "pg/avatar/edit/{$user->username}",
'text' => elgg_echo('avatar:edit'),
'contexts' => array('profile_edit'),
- );
- elgg_register_menu_item('page', $params);
- $params = array(
+ ));
+
+ elgg_register_menu_item('page', array(
'name' => 'edit_profile',
'href' => "pg/profile/{$user->username}/edit",
'text' => elgg_echo('profile:edit'),
'contexts' => array('profile_edit'),
- );
- elgg_register_menu_item('page', $params);
+ ));
+
+ elgg_register_menu_item('topbar', array(
+ 'name' => 'profile',
+ 'href' => $user->getURL(),
+ 'text' => "<img src=\"{$user->getIconURL('topbar')}\" alt=\"$user->name\" />",
+ ));
+
+ elgg_register_menu_item('topbar', array(
+ 'name' => 'friends',
+ 'href' => "pg/friends/{$user->username}",
+ 'text' => elgg_view_icon('friends'),
+ 'title' => elgg_echo('friends'),
+ ));
+
+ elgg_register_menu_item('topbar_alt', array(
+ 'name' => 'usersettings',
+ 'href' => "pg/settings/user/{$user->username}",
+ 'text' => elgg_view_icon('settings') . elgg_echo('settings'),
+ 'weight' => 500
+ ));
+
+ elgg_register_menu_item('topbar_alt', array(
+ 'name' => 'logout',
+ 'href' => "action/logout",
+ 'text' => elgg_echo('logout'),
+ 'is_action' => TRUE,
+ 'weight' => 1000,
+ ));
+
}
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'elgg_user_hover_menu');
diff --git a/views/default/page/elements/topbar.php b/views/default/page/elements/topbar.php
index 88ffa85e0..cac7cb360 100644
--- a/views/default/page/elements/topbar.php
+++ b/views/default/page/elements/topbar.php
@@ -4,9 +4,7 @@
* The standard elgg top toolbar
*/
-$user = elgg_get_logged_in_user_entity();
-//@todo echo elgg_view_menu('topbar', array('class' => 'elgg-menu-topbar'));
// Elgg logo
$image = '<img src="' . elgg_get_site_url() . '_graphics/elgg_toolbar_logo.gif" alt="Elgg logo" />';
@@ -15,52 +13,11 @@ echo elgg_view('output/url', array(
'text' => $image,
));
-// avatar
-$user_link = $user->getURL();
-$user_image = $user->getIconURL('topbar');
-$image = "<img src=\"$user_image\" alt=\"$user->name\" class=\"bab\" />";
-echo elgg_view('output/url', array(
- 'href' => $user_link,
- 'text' => $image,
-));
+echo elgg_view_menu('topbar', array('sort_by' => 'weight'));
-// friends
-echo elgg_view('output/url', array(
- 'href' => "pg/friends/{$user->username}/",
- 'text' => elgg_view_icon('friends'),
- 'title' => elgg_echo('friends'),
-));
-
-// logout link
-echo elgg_view('output/url', array(
- 'href' => "action/logout",
- 'text' => elgg_echo('logout'),
- 'is_action' => TRUE,
- 'class' => 'elgg-alt',
-));
+echo elgg_view_menu('topbar_alt', array('sort_by' => 'weight'));
// elgg tools menu
// need to echo this empty view for backward compatibility.
// @todo -- do we really? So much else is broken, and the new menu system is so much nicer...
echo elgg_view("navigation/topbar_tools");
-
-// enable elgg topbar extending
-echo elgg_view('elgg_topbar/extend', $vars);
-
-//@todo echo elgg_view_menu('topbar2', array('class' => 'elgg-menu-topbar elgg-alt'));
-
-// user settings
-echo elgg_view('output/url', array(
- 'href' => "pg/settings/user/{$user->username}",
- 'text' => elgg_view_icon('settings') . elgg_echo('settings'),
- 'class' => 'elgg-alt',
-));
-
-// The administration link is for admin or site admin users only
-if ($user->isAdmin()) {
- echo elgg_view('output/url', array(
- 'href' => 'pg/admin/',
- 'text' => elgg_view_icon('settings') . elgg_echo('admin'),
- 'class' => 'elgg-alt',
- ));
-}