2017-11-23, 03:22 AM
I'm writing a MyBB Plugin and would like to display a variable on the index page. However the variable $mystaffonline {$mystaffonline} does not render on my index board stats template. I'm sure I must be doing something wrong. Could someone provide me a more clear example?
<?php
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.");
}
$plugins->add_hook('index_start', 'staffonline_index');
function staffonline_info()
{
return array(
"name" => "Staff Online",
"description" => "Display currently online staff members",
"website" => "https://mybb.solutions/",
"author" => "JustAnotherRandomDude",
"authorsite" => "https://mybb.solutions/",
"version" => "1.0",
"codename" => "staffonline",
"compatibility" => "18*"
);
}
/*
function staffonline_install()
{
}
function staffonline_is_installed()
{
}
function staffonline_uninstall()
{
}
*/
function staffonline_activate()
{
}
function staffonline_deactivate()
{
}
function staffonline_index()
{
global $mybb, $db, $lang, $templates, $theme;
$mystaffonline = "<h1>lol</h1>";
eval($templates->render('index'));
}