aboutsummaryrefslogtreecommitdiff
path: root/mod/messages
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages')
-rw-r--r--mod/messages/start.php15
-rw-r--r--mod/messages/views/default/widgets/messages/edit.php0
-rw-r--r--mod/messages/views/default/widgets/messages/view.php13
3 files changed, 5 insertions, 23 deletions
diff --git a/mod/messages/start.php b/mod/messages/start.php
index 198494474..fbf9bc543 100644
--- a/mod/messages/start.php
+++ b/mod/messages/start.php
@@ -20,7 +20,6 @@
* @param unknown_type $object_type
* @param unknown_type $object
*/
-
function messages_init() {
// Load system configuration
@@ -28,7 +27,7 @@ function messages_init() {
//add submenu options
if (get_context() == "messages") {
- add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . $_SESSION['user']->username);
+ add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . get_loggedin_user()->username);
add_submenu_item(elgg_echo('messages:sentmessages'), $CONFIG->wwwroot . "mod/messages/sent.php");
}
@@ -50,12 +49,8 @@ function messages_init() {
// Register a notification handler for site messages
register_notification_handler("site", "messages_site_notify_handler");
register_plugin_hook('notify:entity:message','object','messages_notification_msg');
- if (is_callable('register_notification_object'))
- register_notification_object('object','messages',elgg_echo('messages:new'));
-
- // Shares widget
- // add_widget_type('messages',elgg_echo("messages:recent"),elgg_echo("messages:widget:description"));
-
+ register_notification_object('object','messages',elgg_echo('messages:new'));
+
// Override metadata permissions
register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata');
@@ -295,10 +290,10 @@ function count_unread_messages() {
//get the users inbox messages
//$num_messages = get_entities_from_metadata("toId", $_SESSION['user']->getGUID(), "object", "messages", 0, 10, 0, "", 0, false);
$num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array(
- 'toId' => $_SESSION['user']->guid,
+ 'toId' => get_loggedin_userid(),
'readYet' => 0,
'msg' => 1
- ), 'owner_guid' => $_SESSION['user']->guid));
+ ), 'owner_guid' => get_loggedin_userid()));
if (is_array($num_messages))
$counter = sizeof($num_messages);
diff --git a/mod/messages/views/default/widgets/messages/edit.php b/mod/messages/views/default/widgets/messages/edit.php
deleted file mode 100644
index e69de29bb..000000000
--- a/mod/messages/views/default/widgets/messages/edit.php
+++ /dev/null
diff --git a/mod/messages/views/default/widgets/messages/view.php b/mod/messages/views/default/widgets/messages/view.php
deleted file mode 100644
index e4d138562..000000000
--- a/mod/messages/views/default/widgets/messages/view.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
- <?php
-
- $num_messages = count_unread_messages();
-
- if($num_messages == 0)
- echo "<h3 class=\"new_messages_count\">You have no new messages.</h3>";
- else {
- echo "<h3 class=\"new_messages_count\">" . $num_messages . " new message(s).</h3>";
- echo "<a href=\"" . $vars['url'] . "pg/messages/" . $_SESSION['user']->username ."\">check them out</a>";
- }
-
- ?>