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
How do I make it so when a user is logged in, the "Welcome Guest" message disappears? I'm trying to make this work in the templates.
Assuming you're using the two different welcomeblock templates like suggested in your other thread, it does... put whatever you want members to see in the member welcomeblock and whatever you want guests to see in the guest welcomeblock.
So why is it when a person logs in, the message says "Welcome, Guest Welcome back, Admin"

I want it so when a user logs in, only the "Welcome back, (username)" appears. I want the welcome guest message to disappear.

Here's what I have for the code
{$lang->welcome_guest}{$lang->welcome_back}
Well because you've put {$lang->welcome_guest} there which will always say 'Welcome, Guest'... Undecided

Put this in the member template: {$lang->welcome_back}
and this in the guest template: {$lang->welcome_guest}

Isn't that how it is by default though...?? Huh

If you put them both in the same template it's going to load both language strings...
But I set up an arcade here: http://wafflepwn.com/forum/games.php

I'm trying to bring the "Welcome Guest" and "Welcome member" over there. When people are logged in my site, I only want the "Welcome username" to appear. There has to be a way to accomplish this.
That's the first time you've actually explained where this is being used and why it's different to normal...

Just put {$welcomeblock} in, that'll put in the full welcomeblock depending on who's logged in. If you really only want that text you'll just have to edit the PHP in some way, it needs PHP to tell if you're logged in.
I don't see the template welcomeblock though. I see four templates with the word "header" with the word "welcomeblock." Example: header_welcomeblock_member. If I edit that though, it will make the one on my forum different, which I don't want. I'm trying to make the login look exactly like the one on the homepage of http://www.wafflepwn.com. I'm guessing I need to make another template. But how do I go about doing that?
Yeah, there's four templates with welcomeblock in the name, there isn't one just called welcomeblock, {$welcomeblock} shows the appropriate welcomeblock depending on if you're logged in or not. You'll need PHP to do what you need. If you make another template, you'll still need PHP to call it and tell it what to show in it.
I would LOVE to use php in a template, but it does not work. I use php for the home page of my site so users can be prompted to login if they're guests. So since I can't input php in a template, what do I do? Just so you know, I'm editing my arcade from a template, and in a template, you can't put php code in there.

Here's the code I use on my other pages of the website. Example, the home page. (This is the code I wish I can use in my template)

<?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>";
}
?>
Put it in the games.php file, and tell it to change the value of a variable depending on them being a guest/user, and then echo that variable.
Pages: 1 2