Na, wenn wir schon so zwanglos diskutieren, dann habe ich folgende Datei "awaytoday.lang.php" genannt und in die jeweiligen inc/languages-Ordner gepackt:
Und eine Datei namens "whoisawaytoday.php" in inc/plugins mit folgendem Inhalt:
Code:
<?php
if(!defined("IN_MYBB"))
{
die("This file cannot be accessed directly.");
}
$plugins->add_hook('index_start', 'add_whoisawaytoday', 1000000);
function whoisawaytoday_info()
{
return array(
"name" => "Who is away?",
"description" => "Shows the users that are away on the index.",
"website" => "",
"author" => "",
"authorsite" => "",
"version" => "1.0",
"guid" => "",
"compatibility" => "18*",
);
}
function whoisawaytoday_activate()
{
global $db;
$template2 = array(
"tid" => NULL,
"title" => "index_whosaway_memberbit",
"template" => "{\$comma}{\$userprofilelink} ({\$awaydate} - {\$returndate}){\$awayreason}",
"sid" => "-1"
);
$db->insert_query("templates", $template2);
$template1 = array(
"tid" => NULL,
"title" => "index_whosaway",
"template" => "<tr>
<td class=\"tcat\"><span class=\"smalltext\"><strong>{\$lang->whos_away_today}</strong></span></td>
</tr>
<tr>
<td class=\"trow1\"><span class=\"smalltext\">{\$lang->away_note_today}<br />{\$awaymembers}</span></td>
</tr>",
"sid" => "-1"
);
$db->insert_query("templates", $template1);
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('index_boardstats', '#{\$birthdays}#', "{\$birthdays}\n{\$away_today}");
}
function whoisawaytoday_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_whosaway'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_whosaway_memberbit'");
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('index_boardstats', '#(\n?){\$away_today}#', '', 0);
}
function add_whoisawaytoday()
{
global $db, $mybb, $templates, $away_today, $lang, $theme, $collapsed;
$away_today = '';
if($mybb->settings['showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0)
{
$lang->load("awaytoday");
$lang->load("index");
$comma = $awaymembers = '';
$membercount = 0;
$query = $db->simple_select(
"users u",
"u.uid, u.username, u.awaydate, u.returndate, u.awayreason, u.usergroup, u.displaygroup",
"u.awaydate <> '0' ORDER BY u.username ASC"
);
while($user = $db->fetch_array($query))
{
if($user['username'])
{
$awaydate = date("d.m.Y",$user['awaydate']);
$returndate = "?";
if($user['returndate'] && $user['returndate'] != 0) {
$timestamp = strtotime($user['returndate']);
$returndate = date("d.m.Y",$timestamp);
}
$awayreason = "";
if($user['awayreason']) {
$awayreason = " „".$user['awayreason']."“ ";
}
$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
$userprofilelink = build_profile_link($user['username'], $user['uid']);
eval("\$awaymembers .= \"".$templates->get("index_whosaway_memberbit", 1, 0)."\";");
$comma = ", ";
$membercount++;
}
}
$memberbit = ($membercount != 1) ? $lang->online_member_plural : $lang->online_member_singular;
$lang->away_note_today = $lang->sprintf($lang->away_note_today, my_number_format($membercount), $memberbit);
eval("\$away_today = \"".$templates->get("index_whosaway")."\";");
}
}
?>
Und dann brauchte ich das Plugin nur noch zu aktivieren...