diff --git a/Sources/Profile-View.php b/Sources/Profile-View.php index 8481a513b4..c97ef37cd5 100644 --- a/Sources/Profile-View.php +++ b/Sources/Profile-View.php @@ -459,13 +459,22 @@ function ($format) use ($scripturl) else unset($alerts[$id_alert]['visible']); + // For developer convenience. + $alert = &$alerts[$id_alert]; + + // If we loaded the sender's profile, we may as well use it. + $sender_id = !empty($alert['sender_id']) ? $alert['sender_id'] : 0; + if (isset($user_profile[$sender_id])) + $alert['sender_name'] = $user_profile[$sender_id]['real_name']; + + // If requested, include the sender's avatar data. + if ($with_avatar && !empty($senders[$sender_id])) + $alert['sender'] = $senders[$sender_id]; + // Did a mod already take care of this one? if (!empty($alerts[$id_alert]['text'])) continue; - // For developer convenience. - $alert = &$alerts[$id_alert]; - // The info in extra might outdated if the topic was moved, the message's subject was changed, etc. if (!empty($alert['content_data'])) { @@ -519,15 +528,6 @@ function ($format) use ($scripturl) $alert['extra']['user_name'] = $user_profile[$alert['extra']['user_id']]['real_name']; } - // If we loaded the sender's profile, we may as well use it. - $sender_id = !empty($alert['sender_id']) ? $alert['sender_id'] : 0; - if (isset($user_profile[$sender_id])) - $alert['sender_name'] = $user_profile[$sender_id]['real_name']; - - // If requested, include the sender's avatar data. - if ($with_avatar && !empty($senders[$sender_id])) - $alert['sender'] = $senders[$sender_id]; - // Next, build the message strings. foreach ($formats as $msg_type => $format_info) {