MyBB Community Forums

Full Version: Requiring global.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If for some reason I needed to require global.php in my plugin, how could I do this? You can't simply:

require_once 'global.php';

...because the plugin is in inc/plugins. So it looks for inc/plugins/global.php.
No idea why you need to require it, but:
a) that line is not a proper PHP code
b) you should just use a relative path which goes back to root (../ is one directory backwards)
Or use MYBB_ROOT.'global.php'
(2014-07-15, 08:14 AM)King Louis Wrote: [ -> ]Or use MYBB_ROOT.'global.php'

Didn't work?
Ups, yeah, MYBB_ROOT is defined later Big Grin but normally you shouldn't need to require global.php in a plugin file. The plugin file is normally included AFTER global.php