News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Guest Message

Started by Phoenix Man, February 15, 2006, 02:54:00 PM

Previous topic - Next topic

Phoenix Man

Hi. I was wondering if anyone could write a small tutorial on how to add a Guest message.

In "Settings.php" there would be a variable called $guestmsg which would default to 0.
What I want to do is on every page on the forum whenever a Guest is logged in and $guestmsg is not 0 (but instead a string) I want to display the string as a Guest message just like when you get those warning messages like "You cannot post private messages".

I wish to use this to inform my dear Guests that some forums are not visible to them unless they register (to encourage registering).

H

-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Phoenix Man

Alright I don't understand. That link refers to an old bug post...?

fwitt

you'll want something along the lines of

at the top of each template you used it in



global guestmsg;



then everywhere that you wanted the msg to display



if ($context['user']['is_guest'] && ($guestmsg != 0))
{
echo " $guestmsg ";
}




Phoenix Man

Ok. Where can I put it to appear on EVERY page?

kegobeer

Boards are hidden unless a visitor has access to it.  If I deny guest access to a particular board, guests can't see anything about that board.  Were you planning on putting some sort of message on the top of every page telling your guests that you have other boards they can't see?
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

fwitt

Quote from: Phoenix Man on February 15, 2006, 05:34:16 PM
Ok. Where can I put it to appear on EVERY page?

Do you want it to appear in the same way as the news block?

Phoenix Man

Quote from: kegobeer on February 15, 2006, 06:13:09 PM
Boards are hidden unless a visitor has access to it.  If I deny guest access to a particular board, guests can't see anything about that board.  Were you planning on putting some sort of message on the top of every page telling your guests that you have other boards they can't see?
Yes. I want to inform them that they have to register to see the other boards. Maybe even show a list of boards they don't have access to.

Yes.
Quote from: fwitt on February 16, 2006, 03:30:24 AMDo you want it to appear in the same way as the news block?
I'd like to make it appear like if you were banned.

Like this, but then with $guestmsg and only for Guests:

kegobeer

You would put that type of code in index.template.php.  That would guarantee every page would have your message on it.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Advertisement: