aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/users.php2
-rw-r--r--mod/messages/start.php24
-rw-r--r--mod/messages/views/default/messages/topbar.php26
3 files changed, 22 insertions, 30 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index cf50c7ae2..c12f8d00d 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1526,6 +1526,7 @@ function users_init() {
'name' => 'profile',
'href' => $user->getURL(),
'text' => "<img src=\"{$user->getIconURL('topbar')}\" alt=\"$user->name\" />",
+ 'weight' => 100,
));
elgg_register_menu_item('topbar', array(
@@ -1533,6 +1534,7 @@ function users_init() {
'href' => "pg/friends/{$user->username}",
'text' => elgg_view_icon('friends'),
'title' => elgg_echo('friends'),
+ 'weight' => 300,
));
elgg_register_menu_item('topbar_alt', array(
diff --git a/mod/messages/start.php b/mod/messages/start.php
index 44f024024..5e258824f 100644
--- a/mod/messages/start.php
+++ b/mod/messages/start.php
@@ -22,20 +22,36 @@ function messages_init() {
'href' => "pg/messages/inbox/" . elgg_get_logged_in_user_entity()->username,
'context' => 'messages',
));
+
elgg_register_menu_item('page', array(
'name' => 'messages:sentmessages',
'text' => elgg_echo('messages:sentmessages'),
'href' => "pg/messages/sent/" . elgg_get_logged_in_user_entity()->username,
'context' => 'messages',
));
+
+ $class = "elgg-icon messages-icon";
+ $text = "&nbsp;";
+
+ // get unread messages
+ $num_messages = (int)messages_count_unread();
+ if ($num_messages != 0) {
+ $class .= " new";
+ $text = $num_messages;
+ }
+ $text = "<span class='$class'>$text</span>";
+
+ elgg_register_menu_item('topbar', array(
+ 'name' => 'messages',
+ 'href' => 'pg/messages/inbox/' . elgg_get_logged_in_user_entity()->username,
+ 'text' => $text,
+ 'weight' => 600,
+ ));
}
- // Extend system CSS with our own styles, which are defined in the shouts/css view
+ // Extend system CSS with our own styles, which are defined in the messages/css view
elgg_extend_view('css/elgg', 'messages/css');
- // Add icon to the topbar
- elgg_extend_view('elgg_topbar/extend', 'messages/topbar');
-
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('messages', 'messages_page_handler');
diff --git a/mod/messages/views/default/messages/topbar.php b/mod/messages/views/default/messages/topbar.php
deleted file mode 100644
index 90a227f80..000000000
--- a/mod/messages/views/default/messages/topbar.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * Elgg messages topbar extender
- *
- * @package ElggMessages
- */
-
-if (!elgg_is_logged_in()) {
- return true;
-}
-
-// get unread messages
-$num_messages = (int)messages_count_unread();
-
-$class = "elgg-icon messages-icon";
-$text = "&nbsp;";
-if ($num_messages != 0) {
- $class = "$class new";
- $text = $num_messages;
-}
-$text = "<span class='$class'>$text</span>";
-
-echo elgg_view('output/url', array(
- 'href' => 'pg/messages/inbox/' . elgg_get_logged_in_user_entity()->username,
- 'text' => $text,
-));