Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes #3264. Messages from deleted users show up as "Deleted user" in…

…stead of showing the viewer's icon.

git-svn-id: http://code.elgg.org/elgg/branches/1.7@9117 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information...
commit 460625aec6b7f13b2abd68f5eaa7f29824f30038 1 parent ae8c3c8
@brettp brettp authored
View
34 mod/messages/languages/en.php
@@ -1,11 +1,11 @@
<?php
$english = array(
-
+
/**
* Menu items and titles
*/
-
+
'messages' => "Messages",
'messages:back' => "back to messages",
'messages:user' => "Your inbox",
@@ -29,31 +29,31 @@
'messages:answer' => "Reply",
'messages:toggle' => 'Toggle all',
'messages:markread' => 'Mark read',
-
+
'messages:new' => 'New message',
-
+
'notification:method:site' => 'Site',
-
+
'messages:error' => 'There was a problem saving your message. Please try again.',
-
+
'item:object:messages' => 'Messages',
-
+
/**
* Status messages
*/
-
+
'messages:posted' => "Your message was successfully sent.",
'messages:deleted' => "Your messages were successfully deleted.",
'messages:markedread' => "Your messages were successfully marked as read.",
-
+
/**
* Email messages
*/
-
+
'messages:email:subject' => 'You have a new message!',
'messages:email:body' => "You have a new message from %s. It reads:
-
+
%s
@@ -66,11 +66,11 @@
%s
You cannot reply to this email.",
-
+
/**
* Error messages
*/
-
+
'messages:blank' => "Sorry; you need to actually put something in the message body before we can save it.",
'messages:notfound' => "Sorry; we could not find the specified message.",
'messages:notdeleted' => "Sorry; we could not delete this message.",
@@ -78,9 +78,9 @@
'messages:nomessages' => "There are no messages to display.",
'messages:user:nonexist' => "We could not find the recipient in the user database.",
'messages:user:blank' => "You did not select someone to send this to.",
-
+
+ 'messages:deleted_sender' => 'Deleted user',
+
);
-
- add_translation("en",$english);
-?>
+ add_translation("en",$english);
View
10 mod/messages/views/default/messages/messages.php
@@ -55,13 +55,19 @@
// from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
// the message. If it is the sentbox, the icon and name will be the user the message was sent to
if ($type == "sent") {
+
//get an instance of the user who the message has been sent to so we can access the name and icon
$user_object = get_entity($vars['entity']->toId);
echo " " . elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:to').": <b>" . $user_object->name . "</b><br />";
} else {
- echo " " . elgg_view("profile/icon",array('entity' => get_entity($vars['entity']->fromId), 'size' => 'tiny'));
- echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . get_entity($vars['entity']->fromId)->name . "</b><br />";
+ $entity = get_entity($vars['entity']->fromId);
+ if ($entity) {
+ echo " " . elgg_view("profile/icon", array('entity' => $entity, 'size' => 'tiny'));
+ echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . $entity->name . "</b><br />";
+ } else {
+ echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . elgg_echo('messages:deleted_sender') . "</b><br />";
+ }
}
?>
<!-- get the time the message was sent -->
View
7 mod/messages/views/default/messages/view.php
@@ -45,7 +45,12 @@
echo "<table width=\"100%\" cellspacing='0'><tr>";
//get the icon of the user who owns the message
$from = get_entity($message->fromId);
- echo "<td width='200px'>" . elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $from->name . "</b><br /><small>" . elgg_view_friendly_time($message->time_created) . "</small></div></td>";
+ if ($from) {
+ echo "<td width='200px'>" . elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $from->name . "</b><br /><small>" . elgg_view_friendly_time($message->time_created) . "</small></div></td>";
+ } else {
+ // deleted sender.
+ echo "<td width='200px'><div class='msgsender'><b>" . elgg_echo('messages:deleted_sender') . "</b><br /><small>" . elgg_view_friendly_time($message->time_created) . "</small></div></td>";
+ }
//display the message title
echo "<td><div class='msgsubject'>";
echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> ";

0 comments on commit 460625a

Please sign in to comment.
Something went wrong with that request. Please try again.