Adding pages to who's online without editing core files?
#1
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
Reply
#2
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.
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#3
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!
Reply
#4
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)