MyBB Community Forums

Full Version: List of mybb globals?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Only a quick one, is there a list of all globals out there (and possibly a description of each)?

Thanks
Close, but i think my question is...

where is $mybb, $db, $user found - i.e if i am new, how do i know they exist?

Where does usercp_do_changename_end come from? - another example of my questions

Is $templatelist a mybb defined variable or one that is user created?

(All taken form plugins i have seen)
Variables and plugin hook placement can be found in PHP files, of course. A list of hooks can also be seen here: http://docs.mybb.com/MyBB_Plugin_Hooks.html List of functions: http://sourcedocs.mybboard.nl/nav.html?_...index.html There is no list of variables because there are thousands of them and they may repeat (for example $user is used in many different while loops).

$templatelist is defined in global.php.
$mybb - inc/init.php
$db - also inc/init.php
Appreciate the response.

Just trying to get my head round what is available to me (to use in a plugin), what needs to be created, and what needs to be included. Either im being daft, or it feels like you guys are born understanding Wink

Maybe this will help, looking at this for example: usercp_do_changename_end

Where is that from, and what difference does it make if it is start or end suffixed?
OP: I had the same questions when I first came around here. Check out the answers that got me on track: http://community.mybb.com/thread-109408.html
(2014-02-05, 01:03 AM)Andre R. Wrote: [ -> ]Maybe this will help, looking at this for example: usercp_do_changename_end

Where is that from, and what difference does it make if it is start or end suffixed?

The best idea is to search through the source code.

[nmalcolm@freedom ~]$ cd /var/www/mybb
[nmalcolm@freedom mybb]$ grep -r -n 'usercp_do_changename_end' .
./usercp.php:1154:			$plugins->run_hooks("usercp_do_changename_end");

File usercp.php
Line 1154

Alternatively you can use Github to search:

https://github.com/mybb/mybb/search?q=us...gename_end
Thanks for the assistance - starting to make a little more sense which is great on my part.

Out of interest, the function pluginName_info() function - which table in the db does that get stored in?
why would it be stored in any table? it calls pluginname_info() any time the info is needed.

use debug messages. If you have a hook and want to know what's available in globals, just print $GLOBALS

note this will contain sensitive information, so you should do this on a dev board, or make sure it's only displayed to you and not others.