title: Joomla 3.x - How to display that certain user is on site to a guest user
body: <p>What I am trying to do is to display to an guest/visitor to a Joomla site that a certain member is currently logged in or not. What I have so far is this: </p>
  
  <pre><code>    //First assigned user object to $user variable
  $user = &amp; JFactory::getUser();
  if($user-&gt;guest){
      //Check user id is zero, if it is zero means user not logged in Joomla
      if ($user-&gt;id == 638) {
          echo "online.";
      } else {
          echo "offline.";
      }
  }
  </code></pre>
  
  <p>However this does not work. I have this method which works only for the person that matches the user id:</p>
  
  <pre><code>//First assigned user object to $user variable
  $user = &amp; JFactory::getUser();
  
  //Check user id is zero, if it is zero means user not logged in Joomla
  if ($user-&gt;id == 638) {
      echo "online.";
  } else {
      echo "offline.";
      }
  
  }
  </code></pre>
  
  <p>But I can't make the work for the guest user. Any help is greatly appreciated.</p>