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).
Do the is_guest info in this topic help:
http://www.simplemachines.org/community/index.php?topic=60003.0
Alright I don't understand. That link refers to an old bug post...?
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 ";
}
Ok. Where can I put it to appear on EVERY page?
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?
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?
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:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg105.imageshack.us%2Fimg105%2F8215%2Flikethis9nd.png&hash=22d36480eb84c4502f948ca7c31ca50db9602529)
You would put that type of code in index.template.php. That would guarantee every page would have your message on it.