aboutsummaryrefslogtreecommitdiff
path: root/mod/messages
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages')
-rw-r--r--mod/messages/actions/delete.php2
-rw-r--r--mod/messages/send.php2
-rw-r--r--mod/messages/sent.php2
-rw-r--r--mod/messages/start.php12
-rw-r--r--mod/messages/views/default/messages/messages.php6
-rw-r--r--mod/messages/views/default/messages/topbar.php4
-rw-r--r--mod/messages/views/default/messages/view.php4
7 files changed, 16 insertions, 16 deletions
diff --git a/mod/messages/actions/delete.php b/mod/messages/actions/delete.php
index 395b5528b..0f5bb2813 100644
--- a/mod/messages/actions/delete.php
+++ b/mod/messages/actions/delete.php
@@ -57,7 +57,7 @@ if ($success) {
if($type == 'sent'){
forward("mod/messages/sent.php?offset={$offset}");
}else{
- forward("mod/messages/?username=" . $_SESSION['user']->username . "&offset={$offset}");
+ forward("mod/messages/?username=" . get_loggedin_user()->username . "&offset={$offset}");
}
} else {
register_error(elgg_echo("messages:notfound"));
diff --git a/mod/messages/send.php b/mod/messages/send.php
index 51ad30592..0435974ce 100644
--- a/mod/messages/send.php
+++ b/mod/messages/send.php
@@ -14,7 +14,7 @@ gatekeeper();
// Get the current page's owner
$page_owner = page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
+ $page_owner = get_loggedin_user();
set_page_owner($page_owner->getGUID());
}
diff --git a/mod/messages/sent.php b/mod/messages/sent.php
index 0cd65d87b..36a054e86 100644
--- a/mod/messages/sent.php
+++ b/mod/messages/sent.php
@@ -22,7 +22,7 @@ $limit = 10;
// Display all the messages a user owns, these will make up the sentbox
// @todo - fix hack where limit + 1 is passed
-$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => $_SESSION['user']->guid, 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset));
+$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => get_loggedin_userid(), 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset));
// Set the page title
diff --git a/mod/messages/start.php b/mod/messages/start.php
index bd8d0680e..a340169c1 100644
--- a/mod/messages/start.php
+++ b/mod/messages/start.php
@@ -114,7 +114,7 @@ function messages_notification_msg($hook_name, $entity_type, $return_value, $par
strip_tags($parameters['entity']->description),
$CONFIG->wwwroot . "pg/messages/" . $user->username,
get_loggedin_user()->name,
- $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid
+ $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_userid()
);
} else if ($parameters['method'] == 'site') return false;*/
}
@@ -165,7 +165,7 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify
// If $from == 0, set to current user
if ($from == 0)
- $from = (int) get_loggedin_user()->guid;
+ $from = (int) get_loggedin_userid();
// Initialise a new ElggObject
$message_to = new ElggObject();
@@ -174,7 +174,7 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify
$message_to->subtype = "messages";
$message_sent->subtype = "messages";
// Set its owner to the current user
- // $message_to->owner_guid = $_SESSION['user']->getGUID();
+ // $message_to->owner_guid = get_loggedin_userid();
$message_to->owner_guid = $send_to;
$message_to->container_guid = $send_to;
$message_sent->owner_guid = $from;
@@ -226,14 +226,14 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify
global $CONFIG;
$message_contents = strip_tags($body);
if ($send_to != get_loggedin_user() && $notify)
- notify_user($send_to, get_loggedin_user()->guid, elgg_echo('messages:email:subject'),
+ notify_user($send_to, get_loggedin_userid(), elgg_echo('messages:email:subject'),
sprintf(
elgg_echo('messages:email:body'),
get_loggedin_user()->name,
$message_contents,
$CONFIG->wwwroot . "pg/messages/" . $user->username,
get_loggedin_user()->name,
- $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid
+ $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_userid()
)
);
@@ -284,7 +284,7 @@ function messages_url($message) {
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 = get_entities_from_metadata("toId", get_loggedin_userid(), "object", "messages", 0, 10, 0, "", 0, false);
$num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array(
'toId' => get_loggedin_userid(),
'readYet' => 0,
diff --git a/mod/messages/views/default/messages/messages.php b/mod/messages/views/default/messages/messages.php
index 364a80b4f..e2bce0f44 100644
--- a/mod/messages/views/default/messages/messages.php
+++ b/mod/messages/views/default/messages/messages.php
@@ -19,7 +19,7 @@ if(get_input("type") == "sent"){
$type = "sent";
} else {
//send back to the users inbox
- $url = $vars['url'] . "pg/messages/" . $vars['user']->username;
+ $url = $vars['url'] . "pg/messages/" . get_loggedin_user()->username;
// set up breadcrumbs context
elgg_push_breadcrumb(elgg_echo('messages:inbox'), $url);
//this is used on the delete link so we know which type of message it is
@@ -34,8 +34,8 @@ if (strncmp($reply_title, "RE:", 3) != 0) {
if (isloggedin())
if (isset($vars['entity'])) {
- if ($vars['entity']->toId == $vars['user']->guid
- || $vars['entity']->owner_guid == $vars['user']->guid) {
+ if ($vars['entity']->toId == get_loggedin_userid()
+ || $vars['entity']->owner_guid == get_loggedin_userid()) {
// display breadcrumbs
elgg_push_breadcrumb($vars['entity']->title);
echo elgg_view('navigation/breadcrumbs');
diff --git a/mod/messages/views/default/messages/topbar.php b/mod/messages/views/default/messages/topbar.php
index 4af635612..4aa23b91a 100644
--- a/mod/messages/views/default/messages/topbar.php
+++ b/mod/messages/views/default/messages/topbar.php
@@ -17,10 +17,10 @@ if($num_messages){
if($num == 0) {
?>
- <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages" >&nbsp;</a>
+ <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages" >&nbsp;</a>
<?php
}else{
?>
- <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages new" ><span><?php echo $num; ?></span></a>
+ <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages new" ><span><?php echo $num; ?></span></a>
<?php
}
diff --git a/mod/messages/views/default/messages/view.php b/mod/messages/views/default/messages/view.php
index feaf6c0c2..41ad11104 100644
--- a/mod/messages/views/default/messages/view.php
+++ b/mod/messages/views/default/messages/view.php
@@ -22,7 +22,7 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
$counter = 0;
foreach($vars['entity'] as $message) {
- if ($message->owner_guid == $vars['user']->guid || $message->toId == $vars['user']->guid) {
+ if ($message->owner_guid == get_loggedin_userid() || $message->toId == get_loggedin_userid()) {
//make sure to only display the messages that have not been 'deleted' (1 = deleted)
if($message->hiddenFrom != 1){
@@ -71,7 +71,7 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
echo "<div class='message sent clearfloat'>";
//get the icon for the user the message was sent to
echo "<div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."</div>";
- echo "<div class='entity_listing_info'><div class='message_sender'>".$_SESSION['user']->name."<p class='entity_subtext'>".elgg_view_friendly_time($message->time_created)."</p></div>";
+ echo "<div class='entity_listing_info'><div class='message_sender'>".get_loggedin_user()->name."<p class='entity_subtext'>".elgg_view_friendly_time($message->time_created)."</p></div>";
// display message subject
echo "<div class='message_subject'>";
//display the link to 'delete'