MyBB Community Forums

Full Version: Problem with online today ,
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i installed dark orange theme , but online today mod is not working with it ...

it is working on other themes , my tables are crashed

[attachment=9486]
I don't have the mod installed. Could you post the code from your online_today template?
here it is , onlinetoday.php

<?php
/**
 * Copyright  2006 CraKteR.
 */
if(!defined("IN_MYBB")) {
    die("This file cannot be accessed directly.");
}

$plugins->add_hook('index_start', 'add_onlinetoday', 1000000);

function onlinetoday_info() {
	return array(
		"name"			=>	"Show the users that has been online today",
		"description"	=>	"Shows the users that has been online within 24 hours.",
		"website"		=>	"http://mcdcpp.net/",
		"author"		=>	"CraKteR",
		"authorsite"	=>	"http://mcdcpp.net/",
		"version"		=>	"1.2.2"
	);
}

function onlinetoday_activate() {
	global $db;
	$template = array(
		"title"		=> "online_today_index",
		"template"	=> "<tr>
	<td class=\"tcat\"><strong>{\$lang->whos_online_today}</strong> [<a href=\"online.php?action=today\">{\$lang->complete_list}</a>]</td>
</tr>
<tr>
	<td class=\"trow1\"><span class=\"smalltext\">{\$lang->online_note_today}<br />{\$onlinemembers}</span></td>
</tr>",
		"sid"		=> -1
	);
	$db->insert_query(TABLE_PREFIX."templates", $template);

	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets('index_boardstats', '#{\$whosonline}#', "{\$whosonline}\n{\$online_today}");
}

function onlinetoday_deactivate() {
	global $db;
	$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='online_today_index'");

	require MYBB_ROOT."/inc/adminfunctions_templates.php";

	find_replace_templatesets('index_boardstats', '#(\n?){\$online_today}#', '', 0);
}

function add_onlinetoday() {
	global $db, $mybb, $templates, $online_today, $lang, $theme;
                $online_today = '';
	$lang->load("index");
	if($mybb->settings['showwol'] != "no" && $mybb->usergroup['canviewonline'] != "no") {
		$timesearch = time() - 24*60*60;
		$queries = array();
		$queries[] = $db->simple_select(
			TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."sessions s ON (u.uid=s.uid)", 
			"s.sid, s.ip, s.time, s.location, u.uid, u.username, u.invisible, u.usergroup, u.displaygroup",
			"u.lastactive > $timesearch ORDER BY u.username ASC, s.time DESC"
		);
		$queries[] = $db->simple_select(
			TABLE_PREFIX."sessions s LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)",
			"s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup",
			"s.time>'$timesearch' ORDER BY u.username ASC, s.time DESC"
		);
		$comma = $onlinemembers = '';
		$membercount = $guestcount = $anoncount = 0;
		$doneusers = $ips = array();
		foreach($queries as $query) {
			while($user = $db->fetch_array($query)) {
				if(isset($user['sid'])) {
					$botkey = strtolower(str_replace("bot=", '', $user['sid']));
				}

				if($user['uid'] > 0) {
					if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']]) {
						if($user['invisible'] == "yes") {
							++$anoncount;
						}
						++$membercount;
						if($user['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes" || $user['uid'] == $mybb->user['uid']) {
							$invisiblemark = ($user['invisible'] == "yes") ? "*" : "";
							$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
							eval("\$onlinemembers .= \"".$templates->get("index_whosonline_memberbit", 1, 0)."\";");
							$comma = ", ";
						}
						if(isset($user['time'])) {
							$doneusers[$user['uid']] = $user['time'];
						} else {
							$doneusers[$user['uid']] = $user['lastactive'];
						}
					}
				} else if(strstr($user['sid'], "bot=") !== false && $session->bots[$botkey] && !in_array($user['ip'], $ips)) {
					$onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup);
					$comma = ", ";
					++$botcount;
				} else {
					++$guestcount;
					$guests[] = $user['ip'];
				}
			}
		}
		$onlinecount = $membercount + $guestcount;
		$onlinebit = ($onlinecount != 1) ? $lang->online_online_plural : $lang->online_online_singular;
		$memberbit = ($membercount != 1) ? $lang->online_member_plural : $lang->online_member_singular;
		$anonbit = ($anoncount != 1) ? $lang->online_anon_plural : $lang->online_anon_singular;
		$guestbit = ($guestcount != 1) ? $lang->online_guest_plural : $lang->online_guest_singular;
		$lang->online_note_today = sprintf($lang->online_note_today, my_number_format($onlinecount), $onlinebit, 24, my_number_format($membercount), $memberbit, my_number_format($anoncount), $anonbit, my_number_format($guestcount), $guestbit);
		eval("\$online_today = \"".$templates->get("online_today_index")."\";");
	}
}
?>

Add colspan="2" to online today mod's columns
I mean the template code from the Admin CP.
<tr>
    <td class=\"tcat\"><strong>{\$lang->whos_online_today}</strong> [<a href=\"online.php?action=today\">{\$lang->complete_list}</a>]</td>
</tr>
<tr>
    <td class=\"trow1\"><span class=\"smalltext\">{\$lang->online_note_today}<br />{\$onlinemembers}</span></td>
</tr>

Change the code above with following:

<tr>
    <td class=\"tcat\" colspan=\"2\"><strong>{\$lang->whos_online_today}</strong> [<a href=\"online.php?action=today\">{\$lang->complete_list}</a>]</td>
</tr>
<tr>
    <td class=\"trow1\" colspan=\"2\"><span class=\"smalltext\">{\$lang->online_note_today}<br />{\$onlinemembers}</span></td>
</tr>
not working this error came up after the changes

Quote:Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/pakvisio/public_html/urdu/inc/plugins/onlinetoday.php on line 35
Deactivate previous plugin and use the following
[attachment=9496]
Thank You very much you , it worked fine , I am So Thank you ,