Mod Name / Version - Show Users in Chat 1.0 Description - This adds a box to the top of your page showing the number of users in the chat room. Working Under - UBB.Threads 6.3 Pre-requisites - One of the chat integration Mods Author - JoshPet - www.joshuapettit.com Credits - Me Files Altered - ubbt.inc.php, ubbt_registerednav.tmpl, ubbt_unregisterednav.tmpl Database Altered - none New Files - none ### ### Note: ### You may need to alter the query based on the script name of your integrated chat room. For example - if your chat script is rchat.php then use 'rchat' in the Query. If it's chat.php, then use 'chat' in the query. I have written this to query for multiple scripts - as used in the Popup free chatroom integration (which is my latest and what I recommend). Find it here: http://www.threadsdev.com/forum/showflat.php?Number=83572 There is more than one script which loads to chat, so to be most accurate it's best to query for multiple scripts. Also note - if your chatroom is not chat.php - you may need to alter the link to chat.php in 2 places in the ubbt.inc.php file. ######################### ### Open ubbt.inc.php ### ######################### ############## ## Find this: ## // ------------------------------------------- // Now require the registerednav.php template $html = new html; list($tbopen,$tbclose) = $this -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/ubbt_unregisterednav.tmpl"); } ## ## Change to: ## // ---------------------------- // Let's see if there are any people in the chat room - by JoshPet $query = " SELECT COUNT(*) FROM {$config['tbprefix']}Online WHERE O_What = 'chatheader' OR O_What = 'chatroom' OR O_What = 'chat' "; $sth = $dbh -> do_query($query); list($chatcount) = $dbh -> fetch_array($sth); if ($chatcount == "1") { $chatoutput = "There is currently $chatcount user in the Chat Room. Join them!"; } else if ($chatcount > "1") { $chatoutput = "There are currently $chatcount users in the Chat Room. Join them!"; } else { $chatoutput = ""; } // ------------------------------------------- // Now require the registerednav.php template $html = new html; list($tbopen,$tbclose) = $this -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/ubbt_unregisterednav.tmpl"); } ############## ## Find this: ## // ------------------------------------------- // Now require the registerednav.php template $html = new html; list($tbopen,$tbclose) = $this -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/ubbt_registerednav.tmpl"); } } ## ## Change to: ## // ---------------------------- // Let's see if there are any people in the chat room - by JoshPet $query = " SELECT COUNT(*) FROM {$config['tbprefix']}Online WHERE O_What = 'chatheader' OR O_What = 'chatroom' OR O_What = 'chat' "; $sth = $dbh -> do_query($query); list($chatcount) = $dbh -> fetch_array($sth); if ($chatcount == "1") { $chatoutput = "There is currently $chatcount user in the Chat Room. Join them!"; } else if ($chatcount > "1") { $chatoutput = "There are currently $chatcount users in the Chat Room. Join them!"; } else { $chatoutput = ""; } // ------------------------------------------- // Now require the registerednav.php template $html = new html; list($tbopen,$tbclose) = $this -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/ubbt_registerednav.tmpl"); } } ###################################### ### Open ubbt_unregisterednav.tmpl ### ###################################### ############## ## Find this: ## $tbclose
## ## Change to: ## $chatoutput $tbclose
#################################### ### Open ubbt_registerednav.tmpl ### #################################### ############## ## Find this: ## $tbclose
## ## Change to: ## $chatoutput $tbclose