MyBB Community Forums

Full Version: display text on home only if guest
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey!

I want to add a text on my homepage to welcome users. It should be only seen when not logged in.
For that i wanted to add the text to the template "index" using "if".

Now i read somewhere that it's not possible to use if in an template - is that right - so how should i do it then?

i tried following codes:
<?php
if($mybb->user['uid'] == 0) <- Gast
{?><p>TEXT</p><?}
?>

and also: (which i found on the internet)
<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
My text here
<!-- ENDIF -->


both just place the text without looking after if somebody is logged in or not.

Does anybody now how to do that?

thanks
karo
You've to use [url=http://community.mybb.com/thread-31860.html]Template Conditionals plugin[/url=] before adding PHP in templates. After installing this plugin, open index template and add the following code where you want text to appear;
<if $mybb->user['usergroup'] == "1" then>YOUR CODE GOES HERE.</if>