MyBB Community Forums

Full Version: Adding pages to who's online without editing core files?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I presume there is a way to do this Smile

Anyone know? I'd rather not edit core files Smile


My code ATM:
 
    global $mybb, $theme, $plugins;
    add_breadcrumb("FAQs","faqs.php");
$plugins->add_hook("build_friendly_wol_location_end", "faqs_build_online_link");       
    //tell MyBB where we are:
    function faqs_build_online_link(&$plugin_array)
    {
        if (preg_match('/faqs\.php/',$plugin_array['user_activity']['location']))
        {
            $plugin_array['location_name'] = "Viewing <a href=\"faqs.php\">FAQs</a>";
        }

        return $plugin_array;
    }

Also, this is in ./faqs.php not an actual plugin Confused So i did
not without a plugin. i have been considering making one to run in the ACP that you can add custom WOL content, but I have not had the time yet.
As pavemen said, you have to use a plugin unfortunately. Here's the code though - just to speed things up for you Wink

$plugins->add_hook('build_friendly_wol_location_end', 'online_location');
function online_location(&$plugin_array) {
	if ($plugin_array['user_activity']['activity'] == 'misc' && my_strpos($plugin_array['user_activity']['location'], 'xyz')) {
		$plugin_array['location_name'] = 'Viewing XYZ';
	}
}

@pavemen: that sounds like a fantastic idea! Do it!
OK Toungue nvm then Smile I'lljust add it into our "core" plugin Smile seems to work fine Smile

Thanks guys Smile


Although, it would be nice to be able to declare the location of any file with a function Smile