MyBB Community Forums

Full Version: Need {$onlinemembers} to work in all templates, namely global templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I noticed that when I added {$onlinemembers} to a global template I was not getting any output. Is it possible to do so? I'm looking for a list of the users online, with coloured usernames and profile-page links etc.

I've got the PHP-in-templates plugin so raw PHP code could also work I suppose.

Any help is appreciated.
Thanks!
It can't work in all locations by default as it's only created in index.php

Your best would be to have a plugin that hooks into global_start, copy the code from index.php that generates this, and then it'd be available.
It requires a bit more than a template to get it work globally. Read some of the core MyBB files, to see how the templating system works and if you want to have a global template, I'd suggest you to put your code in either global.php or create a plugin hooking into the global.php

Best wishes.
Ok, thanks guys
Take a gander at inc/class_sdk.php, specifically the onlineUsers method.