MyBB Community Forums

Full Version: Show New costum page in "who is online"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello evryone ,

i' adding New page to my forum using this tutorial : http://community.mybb.com/thread-6615.html

this is the image that i make : http://www.bahi-education.com/forum/meteo.php

but the problime is when i'm going to "who is online" and somone in the page i got this "Unknown Location" !! Sad

Please How i can show it in who is online ?? thank you Smile
This should be in development not general support.

You must hook to "build_friendly_wol_location_end" and then your function must be similar to this one:
function meteo_online(&$plugin_array)
{
	if (preg_match('/meteo\.php/',$plugin_array['user_activity']['location']))
	{
		$plugin_array['location_name'] = "Viewing <a href=\"meteo.php\">Meteo</a>";
	}
	
	return $plugin_array;

}
Do you mean that i need to make a plugin for That ??
Yes that is correct, otherwise the function wouldn't get executed.

It doesn't require a huge amount of code, download the attached plugin template and modify:
$plugins->add_hook("my_hook", "myplugin_function");

To:
$plugins->add_hook("build_friendly_wol_location_end", "myplugin_function");

And in the function myplugin_function() put:
function myplugin_function(&$plugin_array)
{
    if (preg_match('/meteo\.php/',$plugin_array['user_activity']['location']))
    {
        $plugin_array['location_name'] = "Viewing <a href=\"meteo.php\">Meteo</a>";
    }
    
    return $plugin_array;

} 

That should do it.
I'm looking for this same thing, what must I change on your code if my pages are donate.php and rules.php ?
Well change "meteo" to "donate" and "Meteo" to "Donate"
Alright thank you, it works.
thank you very much i test it in Localhost and it work prefectly Smile

But i have an other question : this one worked for "Meteo page" , How about if i add more costum pages ??
Like this:

function myplugin_function(&$plugin_array)
{
    if (preg_match('/meteo\.php/',$plugin_array['user_activity']['location']))
    {
        $plugin_array['location_name'] = "Viewing <a href=\"meteo.php\">Meteo</a>";
    }


    if (preg_match('/meteo2\.php/',$plugin_array['user_activity']['location']))
    {
        $plugin_array['location_name'] = "Viewing <a href=\"meteo2.php\">Meteo2</a>";
    }
    
    return $plugin_array;

} 
ok thank you Smile
Pages: 1 2