Chat active number!

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Chat active number!

      Hi! I've seen in some servers that they have this small red box near chat icon or forum icon that shows how many users are active or new messages written since you last checked. Does anybody has a code or an idea how to make that?
    • PHP Source Code

      1. $db = Database::get();
      2. $sql = "SELECT count(*) as online FROM %%CHAT_ON%% WHERE dateTime > DATE_SUB(NOW(), interval 2 MINUTE) AND channel = 0";
      3. $chatUsers = $db->select($sql);
      add the code to AbstractGamePage.class.php on line 139

      then add the following code under $this->assign(array(

      Source Code

      1. 'chatonline' => $chatUsers[0]['online'],
      now u can use {$chatonline} in the template
      it will be the number of users online in the chat, within the last 2 min in channel 0.