MyBB Community Forums

Full Version: Users browsing this page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

How could I make something similar to Users viewing this thread for a custom page so people know who is on that page?

I have got a PHP plugin so I can use that in templates. Is there an easy way to do this or not


Also, I have a custom php page for some content but it appears as 'unknown' in online list, is there an easy way to make it say the page name?

Thanks
You can query the sessions table and check who has your custom page as location there.

EDIT: missed the WOL 'unknown' question - you need to use code like this in a plugin:
$plugins->add_hook("build_friendly_wol_location_end", "your_plugin_hook");
function your_plugin_hook(&$plugin_array)
{
	if(preg_match('/yourpagename\.php/', $plugin_array['user_activity']['location']))
	{
		global $lang, $mybb;
		$lang->load("your_lang");
		
		$plugin_array['location_name'] = $lang->your_string_from_lang_file;
	}

	return $plugin_array;
}
(2014-01-11, 06:18 PM)Destroy666 Wrote: [ -> ]You can query the sessions table and check who has your custom page as location there.

EDIT: missed the WOL 'unknown' question - you need to use code like this in a plugin:
$plugins->add_hook("build_friendly_wol_location_end", "your_plugin_hook");
function your_plugin_hook(&$plugin_array)
{
	if(preg_match('/yourpagename\.php/', $plugin_array['user_activity']['location']))
	{
		global $lang, $mybb;
		$lang->load("your_lang");
		
		$plugin_array['location_name'] = $lang->your_string_from_lang_file;
	}

	return $plugin_array;
}

I don't know how to implement that haha, wouldn't that cause a silly amount of queries?
Well, PHP/MySQL knowledge is required.

And no, it should be 1 easy query to get the users and no queries for WOL text.
(2014-01-11, 06:39 PM)Destroy666 Wrote: [ -> ]Well, PHP/MySQL knowledge is required.

And no, it should be 1 easy query to get the users and no queries for WOL text.

Well, I am not knowledgeable in those languages. :/