MyBB Community Forums

Full Version: All Variable Solved that are stored in $mybb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well i am a mybb plugin developer or you can say i am just starter so everytime i need to think about mybb variable but today i solved this. All Variables are front of me..
If you are new and also looking for this then this will be helpful for you, however some variables are still in array but its not necessary for now. i know we can see all variables by using "print_r" but its a headache so use my script for easy access:
Create a php file on root of your mybb (mybb installed url) and then put following code into it:
<?php
define("IN_MYBB", 1);
require_once 'global.php';
echo "<table border='1' width='100%'>";
foreach($mybb as $key => $value)
{
	echo "<tr><td><h3>";
	echo $key;
	echo "</h3>";
	foreach($value as $val => $va)
	{
		echo "<br>".$val;
		echo " : ".$va;
	}
	echo "</td></tr>";
}
echo "</table>";
?>

Hope this will be helpfor you..

[Add me reps if you like] Smile
I tried this just out of interest. This has the potential to be pretty useful for beginning plugin developers. Very nice. Big Grin
If you know database fields a lot of syntax becomes second nature.

Ex. $mybb->user['uid'], $mybb->usergroup[permissionname]
Wouldn't it be nice if that table you are creating was added to the documents section of MyBB so that we don't have to use the script in order to get the details?
(2014-10-30, 06:48 PM)HolyPhoenix Wrote: [ -> ]Wouldn't it be nice if that table you are creating was added to the documents section of MyBB so that we don't have to use the script in order to get the details?

All tables were printed in the old 1.6 documentation but it hasn't been updated for 1.8 yet.
Note: your code can produce errors when a variable isn't an array ($mybb->request_method for example) or if it's a multi array ($mybb->bla['bla']['bla']; not sure whether the core have that). Using a recursive function would be better.
(2014-10-30, 06:59 PM)Destroy666 Wrote: [ -> ]
(2014-10-30, 06:48 PM)HolyPhoenix Wrote: [ -> ]Wouldn't it be nice if that table you are creating was added to the documents section of MyBB so that we don't have to use the script in order to get the details?

All tables were printed in the old 1.6 documentation but it hasn't been updated for 1.8 yet.

where are these tables? any link? 
(for 1.6, i think that there are not big differences for 1.8)