2017-06-03, 04:39 PM
This simple little script will display all the contents of the $mybb and $theme globals, which I find extremely useful when developing so you don't have to print_r and find what you're looking for. I always like having something like this on hand when I'm making plugins so I figured I'd post it here to help new (or seasoned and maybe lazy ) developers. Just copy this code into a file named test.php or something and put it in the root directory of your board (name doesn't matter, just make sure it's a .php and is in the board's root directory).
***Make sure you either delete this file or comment out line 5
This thread also displays some of the more commonly used properties so you don't have to spool through the whole list if you think you know what you're looking for.
Hope this is helpful! Any suggestions for edits/additions are welcome!
-fizz
<?php
/**
* REMEMBER TO DELETE THIS FILE ON LIVE BOARDS (OR AT LEAST COMMENT OUT DEFINE(IN_MYBB))
* Forum thread: https://community.mybb.com/thread-210859.html
**/
define('IN_MYBB', 1);
require_once("./global.php");
// **If you really need to use this on a live board, change the 1 to your uid and uncomment the line below**
# ($mybb->user['uid'] === 1) ?: die();
// Just add a pound symbol (#) before either of these lines to hide the output
showMybb();
showTheme();
function showMybb()
{
global $mybb;
echo "<b>\$mybb object:</b>\n";
print("<pre>".print_r($mybb, true)."</pre>");
}
function showTheme()
{
global $theme;
echo "<b>\$theme</b>:\n";
print("<pre>".print_r($theme, true)."</pre>");
}
***Make sure you either delete this file or comment out line 5
define('IN_MYBB', 1);
on a live board because this file poses a huge security risk if someone else finds it!***This thread also displays some of the more commonly used properties so you don't have to spool through the whole list if you think you know what you're looking for.
Hope this is helpful! Any suggestions for edits/additions are welcome!
-fizz