MyBB Community Forums

Full Version: [Tutorial] Adding an Online Location to your plugin.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
This a dirty method but works well. It's not language compatible but imho that's not too important for this since it's a location. This will get rid of your UNKNOWN in the location for the who's online page.

For your plugin add this hook call.

Quote: $plugins->add_hook("build_friendly_wol_location_end", "keyword_online");

Then add this as the function:

Quote: function keyword_online(&$plugin_array)
{
if (preg_match('/keyword\.php/',$plugin_array['user_activity']['location']))
{
$plugin_array['location_name'] = "Viewing <a href=\"keyword.php\">TITLE</a>";
}

return $plugin_array;

}

Change the text in red to suit your needs.

If you want lang compatibility you just add a couple lines to the function and alter the text.
Quote: global $lang;
$lang->load("keyword");

Plugin authors should understand the function.

Enjoy.
One thing to ask: What will be the function for setting an Online location to a certain member that will remains fix. I hope you understand my point. For more clearification ; e.g. DesnisTT and Ryan Loose are some what found in majority of time period Reading the thread "Please not PM me for support" Toungue

Can we do this Confused ?
@ghazal, Custom Online Status (available at console world) can do that.
@labrocca thanks I keep forgetting about adding online location to my plugins Blush
Quote:Custom Online Status (available at console world) can do that.
Thanks Toungue I have found one developed by nickman
Thank you Jesse, I think I'll add more dynamic into this script and then put it into my CMS at Zaiendo...

Good job!
The only thing I'd be a little concerned would be this line:
if (preg_match('/keyword\.php/',$plugin_array['user_activity']['location']))
It can give unintended results, but it's not really a big issue.

Otherwise, a nice simple way to get it working Toungue
which is better plugin or the one php edit of functions_online.php of your custom pages? just asking.. Toungue
I'm always against core-edits Wink
By the way, wouldn't strstr work too? (instead of preg_match)
I guess it would.
Pages: 1 2 3