MyBB Community Forums

Full Version: List of MyBB Internal Variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm just getting started learning to customize MyBB templates and themes and also new to HTML, CSS and PHP. I'm actually making progress, but I've hit a brick wall when it comes to customization.

Where can I find a list of all the $mybb->xxx internal variables?

I want to customize my theme to include a list of who's on-line avatars(say 4-8 sized down) somewhere in the header. I used '$mybb->user['avatar']' to display the users avatar in welcomeblock_member, but can't figure out how to get a list of who's on-line and point it to their avatars.

Any help would be greatly appreciated as I have avoided posting this for a while Googling myself and trying not to bother anyone. You'd think a list of MyBB internal variables would be in the Wiki . . . maybe it is and I've missed it.
create a new php called test.php, fill it with the below content and put it in your forum root and then access the url

<?php 
define("IN_MYBB", 1);
include "global.php";
echo '<pre>';
print_r($mybb);
echo '</pre>';

?>


this will dump the entire $mybb object with all its settings, variables, etc.

You can do the same for $db, $lang, $config, $theme, etc.

of course thee will be the default items, any plugins that modify them will not be in this output (except for global_start and global_end)
Thanks so much for your input, but the question remains of why this isn't in the wiki. Shortly after I made this post I realized that the Database Methods section of the wiki contains a lot of good information, but it still seems like a lot is missing. There are references in the templates to variables that I can't find documentation for . . .
since there is an infinite number of possible variables, objects and classes its not possible to document them all, especially with a plugin system that allows folks to create new code.
A lot of the variables that are used in templates are assigned to just that template - basically there's no way we can catalogue every single one used. Or at least it would take a while!

If you see something in the templates, for example {$points}, find where the template is pushed through eval in the PHP file and the variable will be somewhere above it.
As I said in the other plugin thread by Shannon, soon I'll be writing a bunch of stuff for plugin authors into the wiki.
Thanks for all the helpful replies. Smile

(2011-12-10, 12:58 AM)pavemen Wrote: [ -> ]since there is an infinite number of possible variables, objects and classes its not possible to document them all, especially with a plugin system that allows folks to create new code.

Okay. I think I had a basic misunderstanding of the system itself. In my templates(the default template I've copied and modified), I found ($variables) that I couldn't find a template breakdown for so I assumed they were just internal variables that were documented elsewhere(wiki). Blush I have a lot of learning to do it seems. Thanks for the quick replies and helpful answers.

(2011-12-10, 01:22 AM)Tomm M Wrote: [ -> ]A lot of the variables that are used in templates are assigned to just that template - basically there's no way we can catalogue every single one used. Or at least it would take a while!

If you see something in the templates, for example {$points}, find where the template is pushed through eval in the PHP file and the variable will be somewhere above it.

Since reading your input, I have discovered the documented source code. In tandem with your insights, I can see how to track these definitions back a little more clearly. Thanks friend.

(2011-12-10, 03:58 AM)Dylan M. Wrote: [ -> ]As I said in the other plugin thread by Shannon, soon I'll be writing a bunch of stuff for plugin authors into the wiki.

That sounds wonderful. I love this forum software and as in all open-source software I use, I try to give back when I can Smile

As to my original question, I hate to be a bother, but I'd like to run this by anyone listening and just tell me if I'm on the right track. In order to show a custom 'Who's Online List' with avatars instead of just names, would I have to:

a) simply edit the template/style
b) use a plugin(PHP)
c) neither I am screwed :p
???

Any help is always appreciated. Thanks for everything so far.
(2011-12-10, 04:22 AM)Wildcard Wrote: [ -> ]As to my original question, I hate to be a bother, but I'd like to run this by anyone listening and just tell me if I'm on the right track. In order to show a custom 'Who's Online List' with avatars instead of just names, would I have to:

a) simply edit the template/style
b) use a plugin(PHP)
c) neither I am screwed :p
???

Any help is always appreciated. Thanks for everything so far.

either a plugin or a core file edit (change one line, add ) to include the avatar in the output of the query and populate a template variable and then some minor template edits to include the avatar itself.

given how this area is coded, a core edit will be less overhead than a plugin, but harder to maintain with upgrades, etc.
How will this affect upgrades(core edit)? Will I just have to re-edit the index.php file every time I do a minor point upgrade? I don't think that would be too bad.

Practicly I may be jumping the gun with these questions as I don't yet know the languages involved very well, but still I thank you for your help. I have another question, but I think I've worried you guys enough(and it's off topic).

Thanks again pavemen. +1
^ you can use patches plugin for making & maintaining core files edits ..
Pages: 1 2