MyBB Community Forums

Full Version: Conditional show only to guests viewing threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, how can I show a message only to guests viewing threads?
What kind of message do you mean?
Lets just pretend I want to show this one "HELLO WORLD"
You can add the message or things you want on header templates:
header_wellcomeblock_guest

Something like that i don't remember fine xD, but something like that, you can add whatever you want and shows only to guests.

Many users i helped, add some message like vB xD.
as you are using template conditionals plugin, you can use code like below in showthread template
<if $mybb->user['uid'] == 0 then>
content to be shown to guests (not logged in viewers)
</if>
Thanks very much! I know where it should be added but I need conditional control so that only guests browsing threads can see it!

(2013-09-03, 02:08 PM).m. Wrote: [ -> ]as you are using template conditionals plugin, you can use code like below in showthread template
<if $mybb->user['uid'] == 0 then>
content to be shown to guests (not logged in viewers)
</if>

Thanks, how to make your code to show my message only when someone is viewing a thread. For instance http://letsforum.com/Thread
I want to add this code to header template!

Hi .M. what if I can add it to "Navigation Templates"
if you want to show it on the thread pages only then showthread template is the correct place.

if you want to show the message on all pages except the index then code like below can be used in header / footer template
<if $mybb->user['uid'] == 0 && THIS_SCRIPT != "index.php" then>
content to be shown to guests (not logged in viewers)
</if>

I'd not suggest to add such code to navigation templates - but the code can be added to header template below <navigation>
(2013-09-03, 03:03 PM).m. Wrote: [ -> ]if you want to show it on the thread pages only then showthread template is the correct place.

if you want to show the message on all pages except the index then code like below can be used in header / footer template
<if $mybb->user['uid'] == 0 && THIS_SCRIPT != "index.php" then>
content to be shown to guests (not logged in viewers)
</if>

I'd not suggest to add such code to navigation templates - but the code can be added to header template below <navigation>

As always perfect answer! Thanks very much.
Me love you long time