MyBB Community Forums

Full Version: How to make "Welcome Guest" message disappear after login?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have no experience in php. I don't know how to do that.

How do I make it change the value of a variable depending on whether their a guest/user? Why can't I just post the php code as is? It worked on other pages, why not the /forums/games.php page?


<?php

if($mybb->user['uid'])
{
// The user is logged in, say Hi
echo "<font face='georgia'><font size='+1'><font color='white'> Welcome, ".$mybb->user['username']." <font color='white'><font size='-1'><a href='http://www.wafflepwn.com/forum/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}'><font color='white'><font face='georgia'><font size='-1'>[Log Out]</a>.";
}
else
{
// The user is not logged in, Display the form
echo "<font color='white'><font face='georgia'><font size='+1'>Welcome, Guest. <a href='#' id='show' title='Sign in with your Wafflepwn forum account. If you do not have a forum account, click CREATE ACCOUNT on the right.'><font color='white'>Sign in</a> or <a href='http://www.wafflepwn.com/forum/member.php?action=register' title='Creating an account lets you post in the forums, chat with other fans, and enter exclusive contests! CLICK HERE to create an account now!'><font color='white'><font face='georgia'><font size='+1'>Create account</a>";
}
?>
I added this code and now it shows the name of the user when logged in.

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

But what's that mess on the top of the page from?
Never mind. In the code

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

I removed "chdir('forum'); // path to MyBB" so now I don't have warnings on the top of my page. I guess I didn't need that bit since I was already in the forum directory.

Thanks a million for your help!
Pages: 1 2