add_hook("hook name", "function name");
$plugins->add_hook("index_start", "indexonlinetoday_run");
// The information that shows up on the plugin manager
// Note that the name of the function before _info, _activate, _deactivate must be the same as the filename before the extension.
function indexonlinetoday_info()
{
return array(
"name" => "Who Is Online Today on Index",
"description" => "Places Who is Online Today on the Index Page
Place this code at the end of the index_whosonline template:
<tr>
<td class=\"tcat\"><strong>Who was online today?</strong></td>
</tr>
<tr>
<td class=\"trow2\"><span class=\"smalltext\">\$onlinetoday</span></td>
</tr>",
"website" => "http://www.dennistt.net",
"author" => "DennisTT",
"authorsite" => "http://www.dennistt.net",
"version" => "1.0.0",
);
}
// This is the function that is run when the hook is called.
// It must match the function name you placed when you called add_hook.
// You are not just limited to 1 hook per page. You can add as many as you want.
function indexonlinetoday_run()
{
global $mybb, $templates, $db, $onlinetoday;
$stime = time()-(60*60*24);
$query = $db->query("SELECT u.lastactive, u.username, u.invisible, u.usergroup, u.uid, u.displaygroup FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.lastactive > $stime ORDER BY u.lastactive DESC");
$comma = '';
$onlinetoday = '';
while($user = $db->fetch_array($query))
{
if($user['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes")
{
if($user['invisible'] == "yes")
{
$invisiblemark = "*";
}
else
{
$invisiblemark = "";
}
$user['username'] = formatname($user['username'], $user['usergroup'], $user['displaygroup']);
eval("\$onlinetoday .= \"".$templates->get("index_whosonline_memberbit", 1, 0)."\";");
$comma = ', ';
}
}
}
// End of plugin.