MyBB Community Forums

Full Version: Show part of a template only for registered users?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

is it possible to show a part of a template only to user who are logged in?

Thanks in advance! Smile
Thanks for the quick answer and the link!

But I can't write php-code in a template in the adminpanel? Is that right? When I paste the code
if($mybb->user['uid'] != 0) { echo "testing"; }
into my template, the string "testing" doesn't show up?
Right, you can't use PHP in templates. There is a plugin for that but I can't find it at the moment.
Okay. I will find another way then. Thanks a lot.


You can use this :
<?php if(in_array($mybb->user['usergroup'], array(1,7))) { } else {
echo "{$boardstats}";
} ?>

Thats an example of blocking guests (ID=1) & banned (ID=7) from seeing the boardstats. "{$boardstats}" is on the index template.

You also need to install this plugin to allow php in templates:
Yay! That's it!
Thank for your help, Janota Smile
No problem pal Big Grin