Skip to content
This repository
Browse code

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
Brett Profitt authored May 27, 2011
34  mod/messages/languages/en.php
... ...
@@ -1,11 +1,11 @@
1 1
 <?php
2 2
 
3 3
 	$english = array(
4  
-	
  4
+
5 5
 		/**
6 6
 		 * Menu items and titles
7 7
 		 */
8  
-	
  8
+
9 9
 			'messages' => "Messages",
10 10
             'messages:back' => "back to messages",
11 11
 			'messages:user' => "Your inbox",
@@ -29,31 +29,31 @@
29 29
             'messages:answer' => "Reply",
30 30
 			'messages:toggle' => 'Toggle all',
31 31
 			'messages:markread' => 'Mark read',
32  
-			
  32
+
33 33
 			'messages:new' => 'New message',
34  
-	
  34
+
35 35
 			'notification:method:site' => 'Site',
36  
-	
  36
+
37 37
 			'messages:error' => 'There was a problem saving your message. Please try again.',
38  
-	
  38
+
39 39
 			'item:object:messages' => 'Messages',
40  
-	
  40
+
41 41
 		/**
42 42
 		 * Status messages
43 43
 		 */
44  
-	
  44
+
45 45
 			'messages:posted' => "Your message was successfully sent.",
46 46
 			'messages:deleted' => "Your messages were successfully deleted.",
47 47
 			'messages:markedread' => "Your messages were successfully marked as read.",
48  
-	
  48
+
49 49
 		/**
50 50
 		 * Email messages
51 51
 		 */
52  
-	
  52
+
53 53
 			'messages:email:subject' => 'You have a new message!',
54 54
 			'messages:email:body' => "You have a new message from %s. It reads:
55 55
 
56  
-			
  56
+
57 57
 %s
58 58
 
59 59
 
@@ -66,11 +66,11 @@
66 66
 	%s
67 67
 
68 68
 You cannot reply to this email.",
69  
-	
  69
+
70 70
 		/**
71 71
 		 * Error messages
72 72
 		 */
73  
-	
  73
+
74 74
 			'messages:blank' => "Sorry; you need to actually put something in the message body before we can save it.",
75 75
 			'messages:notfound' => "Sorry; we could not find the specified message.",
76 76
 			'messages:notdeleted' => "Sorry; we could not delete this message.",
@@ -78,9 +78,9 @@
78 78
 			'messages:nomessages' => "There are no messages to display.",
79 79
 			'messages:user:nonexist' => "We could not find the recipient in the user database.",
80 80
 			'messages:user:blank' => "You did not select someone to send this to.",
81  
-	
  81
+
  82
+			'messages:deleted_sender' => 'Deleted user',
  83
+
82 84
 	);
83  
-					
84  
-	add_translation("en",$english);
85 85
 
86  
-?>
  86
+	add_translation("en",$english);
10  mod/messages/views/default/messages/messages.php
@@ -55,13 +55,19 @@
55 55
 				// from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
56 56
 				// the message. If it is the sentbox, the icon and name will be the user the message was sent to
57 57
 				if ($type == "sent") {
  58
+
58 59
 					//get an instance of the user who the message has been sent to so we can access the name and icon
59 60
 					$user_object = get_entity($vars['entity']->toId);
60 61
 					echo " " . elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
61 62
 					echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:to').": <b>" . $user_object->name . "</b><br />";
62 63
 				} else {
63  
-					echo " " . elgg_view("profile/icon",array('entity' => get_entity($vars['entity']->fromId), 'size' => 'tiny'));
64  
-					echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . get_entity($vars['entity']->fromId)->name . "</b><br />";
  64
+					$entity = get_entity($vars['entity']->fromId);
  65
+					if ($entity) {
  66
+						echo " " . elgg_view("profile/icon", array('entity' => $entity, 'size' => 'tiny'));
  67
+						echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . $entity->name . "</b><br />";
  68
+					} else {
  69
+						echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . elgg_echo('messages:deleted_sender') . "</b><br />";
  70
+					}
65 71
 				}
66 72
 			?>
67 73
 			<!-- get the time the message was sent -->
7  mod/messages/views/default/messages/view.php
@@ -45,7 +45,12 @@
45 45
 						echo "<table width=\"100%\" cellspacing='0'><tr>";
46 46
 						//get the icon of the user who owns the message
47 47
 						$from = get_entity($message->fromId);
48  
-						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>";
  48
+						if ($from) {
  49
+							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>";
  50
+						} else {
  51
+							// deleted sender.
  52
+							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>";
  53
+						}
49 54
 						//display the message title
50 55
 						echo "<td><div class='msgsubject'>";
51 56
 						echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> ";

0 notes on commit 460625a

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