MyBB Community Forums

Full Version: carrying $mybb outside forum
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
so my forum is located in the folder forums

and my default page is located outside it

so directory structure

public_html
-------/forums
------------forums/index.php
-------default.php

what i wanna do is to be able to use $mybb->user['***'] everything on default.php

but even if i use global.php it still doesn't register anything...however if i place the same default.php page in the forums folder everything works out all the variables read properly and everyhting shows up
outside all blank

any ideas
define("IN_MYBB", 1);
require_once "./forums/global.php";

Try that. That should work, but if it doesn't, you'll need to set chdir to ./forums/. One of these will probably work...
no i already figured that i need to call the globals.php via
require_once "./forums/global.php"; 
and it works -- theres no error so globals.php is being added
to further confirm if i don't add
define("IN_MYBB", 1);
then it just spits out make sure IN_MYBB is defined

but the fact is
<?php

define("IN_MYBB", 1);
define("THIS_SCRIPT","default.php");

require_once "inc/config.php"; // my own config file
require_once $forum_path."/global.php"; // $forum_path is defined in the config file above

echo "Hello ".$mybb->user['username']; // this just outputs hello
?>
that script does not output the username outside the forum ...but does work perfectly inside

i wonder if this has anythin to do with $working_dir variable ??
It will depend on your cookie settings
anything more specific
I think you need one of the support team to answer this question , just wait some time .
may be it is something with functions or you need to include another file .
The support team isn't needed for this case.
You need to change the cookie path and cookie domain in the settings
(2009-10-05, 07:37 PM)Darkmew Wrote: [ -> ]anything more specific

set cookie path to / of the domain Wink.
(2009-10-06, 02:41 AM)NetSage Wrote: [ -> ]
(2009-10-05, 07:37 PM)Darkmew Wrote: [ -> ]anything more specific

set cookie path to / of the domain Wink.

thanks .. i'll try this and let you know
edit-- worked like a charm ...thanks @netsage
* Jitendra M gives netsage a large chocolate filled cookie
(2009-10-05, 09:15 PM)Pirata Nervo Wrote: [ -> ]The support team isn't needed for this case.
You need to change the cookie path and cookie domain in the settings

Hi Pirata , it's nice to meet you here .
Ok . Thanks for your reply