#1288402 by BeaPower: Site' default avatar does not show in streams.
authorStalski
Sun, 19 Feb 2012 17:42:53 +0000 (18:42 +0100)
committerStalski
Sun, 19 Feb 2012 17:42:53 +0000 (18:42 +0100)
heartbeat.module

index c16b589..cc0771d 100755 (executable)
@@ -625,19 +625,32 @@ function heartbeat_activity_view($message, $view_mode = NULL) {
  */
 function heartbeat_heartbeat_activity_view(HeartbeatActivity $heartbeatActivity, $view_mode = 'full', $language = NULL) {
 
-  if ($heartbeatActivity->actor->picture) {
-    $uri = (is_numeric($heartbeatActivity->actor->picture)) ? file_load($heartbeatActivity->actor->picture)->uri : $heartbeatActivity->actor->picture->uri;
+  // Avatar.
+  if (!empty($heartbeatActivity->actor->picture)) {
+    if (is_numeric($heartbeatActivity->actor->picture)) {
+      $uri = file_load($heartbeatActivity->actor->picture)->uri;
+    }
+    else {
+      $uri = $heartbeatActivity->actor->picture->uri;
+    }
     $heartbeatActivity->content['avatar'] = theme('heartbeat_activity_avatar', array('heartbeatactivity' => $heartbeatActivity, 'uri' => $uri));
   }
+  // Default avatar.
+  elseif (variable_get('user_picture_default', '')) {
+    $heartbeatActivity->content['avatar'] = theme('heartbeat_activity_avatar', array('heartbeatactivity' => $heartbeatActivity, 'uri' => variable_get('user_picture_default', '')));
+  }
+  // Activity message.
   $heartbeatActivity->content['message'] = array(
     '#attributes' => array('class' => array('activity-message')),
     '#title' => t('Heartbeat activity message'),
     '#markup' => $heartbeatActivity->message,
   );
+  // Timestamp of occurrence.
   $heartbeatActivity->content['time'] = array(
     '#title' => t('Activity on'),
     '#markup' => theme('heartbeat_time_ago', array('message' => $heartbeatActivity)),
   );
+  // Buttons for this message.
   $heartbeatActivity->content['buttons'] = array(
     '#markup' => theme('heartbeat_buttons', array('message' => $heartbeatActivity)),
   );