MyBB Community Forums

Full Version: Question about login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have the following code on a page of mine.

<?php
define("IN_MYBB", 1);
chdir('forum/'); // path to MyBB
require './global.php';
?>
<?php

if($mybb->user['uid'])
{

echo "Hey, $mybbuser[username].<br>
Thanks for logging in.";
}
else
{

echo "<form action='forums/member.php' method='post'>
Username: <input type='text' name='username' size='25' maxlength='30' /><br />
Password: <input type='password' name='password' size='25' />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='index.php' />
<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}
?>

Everything is fine but there seems to be a problem with the
echo "Hey, $mybbuser[username].
because it does not display the user name. Any ideas for this?
$mybb->user has replaced $mybbuser, so try using $mybb->user['username']
Thank you for the reply. I now get
Quote:Hey, Array['username'].

Here is the code

{

echo "Hey, $mybb->user['username'].<br>
Thanks for logging in.";
}
Use this instead:
echo "Hey, {$mybb->user['username']}.<br>
Thanks for logging in.";

See http://ca3.php.net/manual/en/language.ty...ng.complex
Thank you DennisTT. That did the trick, now I need to figure out how to place that in my site but that is my problem.