Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2004, 09:13 PM
BunkTek BunkTek is offline
 
Join Date: Jul 2004
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help with a mod

I've gotten X7 chat set up and am trying to add a "Currently In Chat" info area, like the "Currently Active Users". I have it all set up and am trying to get the following to work. vBulletin isn't pulling this information like it does on my chat page. I want people reading the forums to be able to see who is chatting from the forum.

Do I need to create a variable?

<?include_once("chatonline.php");list_totals();? >

<?include_once("chatonline.php");list_members(" - ");?>

Once I can get this to work I'll create a thread with everything I've done so that other people can use the information and set up X7, a really nice chat.

This is what the current code looks like in the edited forumhome, I've bolded the code I'm having a problem with:

Code:
<!-- who's in chat -->

<tbody>
	<tr>
		<td class="thead" colspan="2">
			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
			<a href="chatonline.php">Currently In Chat: <?("chatonline.php");list_totals();?></a>
		</td>
	</tr>
</tbody>
<tbody>
	<tr>
		<td class="alt2"><a href="chatonline.php"><img src="chatonline.gif" alt="View Who's Chatting" border="0" /></a></td>
		<td class="alt1" width="100%">
<div class="smallfont">
		<div><?include_once("chatonline.php");list_members(" - ");?></div>
			</div>
</td>
	</tr>
</tbody>	

<!-- end who's in chat -->
I'm no pro at editing vBulletin or modding. The above is cut/edit/paste of the logged in users section directly above this code.

Any help with getting this working will be much appreciated and credited when I post the X7 sort of mod
Reply With Quote
  #2  
Old 10-25-2004, 04:11 AM
BunkTek BunkTek is offline
 
Join Date: Jul 2004
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

More info, here is the code in the chatonline.php that is being called:

Code:
<?
	function who_is_in_chat(){
		// MySql Information
		$user = "";			// Your MySql username
		$pass = "";			// Your MySql password
		$db = "";			// Your MySql Database
		$prefix = "X7Chat_";		// Your table prefix
		$expire_time = 240;	// The amount of seconds that users can be idle before they are considered offline
							// This value is setable in the X7 Chat admin panel, you must also set it here.
							// If the values do not match then the scripts may be inaccurate.
		// No more editing required

		mysql_connect("localhost",$user,$pass);
		mysql_select_db($db);
	
		$exp_time = time()-$expire_time;
		$q = mysql_query("DELETE FROM {$prefix}online WHERE time<'$exp_time'");
		$q = mysql_query("SELECT username FROM {$prefix}online");
		$results = array();
		while($row = mysql_fetch_row($q))
			$results[] = $row[0];
		return $results;
	}
	
	function list_totals(){
		echo count(who_is_in_chat());
	}
	
	function list_members($sep=", "){
		$online = who_is_in_chat();
		echo implode($sep,$online);
	}

?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:45 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06187 seconds
  • Memory Usage 2,175KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete