From 4b22e391e4dc33af526fc350ae0184d1469f92a4 Mon Sep 17 00:00:00 2001
From: moodler <moodler>
Date: Fri, 21 Jan 2005 02:29:29 +0000
Subject: [PATCH] Don't show message shortcut icons when not logged in

---
 blocks/online_users/block_online_users.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/blocks/online_users/block_online_users.php b/blocks/online_users/block_online_users.php
index 05a67fef51..5f75eb53bb 100644
--- a/blocks/online_users/block_online_users.php
+++ b/blocks/online_users/block_online_users.php
@@ -117,7 +117,9 @@ class block_online_users extends block_base {
                     $this->content->text .= '<img src="'.$CFG->pixpath.'/i/user.gif" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
                 }
                 $this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->instance->pageid.'" title="'.$timeago.'">'.$user->fullname.'</a>';
-                $this->content->text .= '&nbsp;<a target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/user.php?id='.$user->id.'" onclick="return openpopup(\'/message/user.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img height="11" width="11" src="'.$CFG->pixpath.'/t/message.gif"></a>';
+                if (!empty($USER->id)) {  // Only when logged in
+                    $this->content->text .= '&nbsp;<a target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/user.php?id='.$user->id.'" onclick="return openpopup(\'/message/user.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img height="11" width="11" src="'.$CFG->pixpath.'/t/message.gif"></a>';
+                }
                 $this->content->text .= '</div>';
             }
         } else {
-- 
2.39.5