MyBB Community Forums

Full Version: Username Issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a custom page (outside my forum root)

My forum location: mysite.com/forum/page.php
My page location: mysite.com/page.php

In page .php I have the following:
define("IN_MYBB", 1);
require_once "./forum/global.php";

But when I try to display the username on page.php it wont display, but when I try to display the forum URL it will display.

Any ideas why the username is not displaying ?

For username im using: {$mybb->user['username']}
For forum url in using : {$mybb->settings['bburl']}
it should be {$mybb->user['username']}
Correct;
{$mybb->user['username']}
Yes thats what I am using (sry that was a typo in my first post)

To clarify im using: {$mybb->user['username']}
^ it appears that user id and user name are not available for use above forum root folder
tested with below code
if(!$mybb->user['uid'])
{
echo "<div>Hi, you are not logged in</div>";
}
else
{
echo "<div">Hi, " . $mybb->user['username'] . "</div>";
} 
but they are available for using below the forum root folder (test page in a sub-folder)
Yea I need access in the folder above the forum root, never encountered this problem before Sad
If your cookie path contains /folder/ then outside of this folder you will be seen as a guest by MyBB because the cookie just isn't there.
(2013-07-16, 09:13 PM)frostschutz Wrote: [ -> ]If your cookie path contains /folder/ then outside of this folder you will be seen as a guest by MyBB because the cookie just isn't there.

Yes my path does contain /folder/.

Is there anyway around this ?
it's a setting ... (might have to change the cookie prefix as well)
(2013-07-16, 10:42 PM)frostschutz Wrote: [ -> ]it's a setting ... (might have to change the cookie prefix as well)

Oh right so changing my cookie path from "/folder/" to "/" and changing my cookie prefix should do it ?

Yep that did it, cheers frostschutz.