MyBB Community Forums

Full Version: how can add Guest s number to online s today ??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi all
how can add Guest to Who has been online today ((Guest s number ))to online s today ??

in my forum it just for user but i want add Guest number ?

like :
Quote:(10 members, 1 of whom is invisible, and 51 guests).
plz how know about it ??!!
You would have to edit the plugin to allow the group ID of zero.
that is code can some one do it for me plz:

<?php
/**
 * MyBB 1.4
 * Copyright © 2008 Samuel
 */

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("index_start", "onlinetoday_run");

function onlinetoday_info()
{
	return array(
		"name"			=> "Online Today",
		"description"	=> "Shows you who has been online in the last 24 Hours",
		"website"		=> "http://gally.x10hosting.com/mybb/",
		"author"		=> "Samuel",
		"authorsite"	=> "http://gally.x10hosting.com/mybb/",
		"version"		=> "1.0",
		"guid" 			=> "3fcc54ee559b73e0778e137eddcd6301",
		"compatibility" => "14*"
	);
}

function onlinetoday_activate()
{
	global $db, $mybb;
	
	$query = $db->simple_select("settinggroups", "COUNT(*) as rows");
	$rows = $db->fetch_field($query, "rows");
	
	$insertarray = array(
		'name' => 'onlinetoday', 
		'title' => 'Show Users Who Have Been online Today', 
		'description' => 'Options on the online today plugin', 
		'disporder' => $rows+1, 
		'isdefault' => 0
	);
	$db->insert_query("settinggroups", $insertarray);
	$group['gid'] = $db->insert_id();
	
	$insertarray = array(
		'name' => 'onlinetoday_active',
		'title' => 'Enable Show Users Who Have Been Online Today Plugin?',
		'description' => 'Enable Show Users Who Have Been online Today Plugin?',
		'optionscode' => 'onoff',
		'value' => 1,
		'disporder' => 0,
		'gid' => $group['gid']
	);
	$db->insert_query("settings", $insertarray);
	
	rebuild_settings();
	
	include MYBB_ROOT."/inc/adminfunctions_templates.php";
	
	find_replace_templatesets("index_boardstats", '#{\$whosonline}(\r?)\n#', "{\$whosonline}\n{\$online_today}\n");
	
	$insert_array = array(
		'title' => "online_today_index",
		'template' => "<tr>
	<td class=\"tcat\"><strong>{\$lang->whos_online_today}</strong></td>
</tr>
<tr>
	<td class=\"trow1\"><span class=\"smalltext\">{\$lang->online_note_today}<br />{\$onlinemembers}</span></td>
</tr>",
		'sid' => "-1",
		'version' => "",
		'dateline' => TIME_NOW
	);
	
	$db->insert_query("templates", $insert_array);
	
}

function onlinetoday_deactivate()
{
	global $db, $mybb;
	
	include MYBB_ROOT."/inc/adminfunctions_templates.php";
	
	find_replace_templatesets("index_boardstats", '#{\$online_today}(\r?)\n#', "", 0);
	
	$db->delete_query("templates", "title = 'online_today_index'");
	
	$db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN(
		'onlinetoday_active'
	)");
	
	$db->delete_query("settinggroups", "name = 'onlinetoday'");
	
	rebuild_settings();
}

function onlinetoday_run()
{
	global $db, $mybb, $templates, $theme, $lang, $online_today;
	
	$lang->load("onlinetoday");
	
	$online_today = '';
	if($mybb->settings['onlinetoday_active'] == "1")
	{
		$onlinedate = time() - 24*60*60;
		$query = $db->simple_select(
			"users", 
			"uid, username, usergroup, displaygroup",
			"lastactive > $onlinedate ORDER BY username ASC"
		);
		$comma = '';
		$onlinecount = 0;
		while($user = $db->fetch_array($query))
		{
			++$onlinecount;
			$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
			$user['profilelink'] = build_profile_link($user['username'], $user['uid']);
			eval("\$onlinemembers .= \"".$templates->get("index_whosonline_memberbit", 1, 0)."\";");
			$comma = ", ";
		}
		$memberword = ($onlinecount != 1) ? $lang->online_member_plural : $lang->online_member_singular;
		$lang->online_note_today = $lang->sprintf($lang->online_note_today, my_number_format($onlinecount), $memberword, 24);
		eval("\$online_today = \"".$templates->get("online_today_index")."\";");
	}

}

?>

thanx T0m
i founded with a plug in not cod and that is a linke :
http://mods.mybboard.net/view/online-today-1.2.2
I am also interested in adding the guest group to my 'online today'. Can anyone help? I'm using 1.4.1 btw.
buy premium at MybbCentral they have it already done Toungue
it not need to MybbCentral ..
just with original mybb Wink
http://mods.mybboard.net/view/online-today-1.2.2