MyBB Community Forums

Full Version: How to display element if user logged in?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Essentially I'm trying to get one of the sidebars on my index to be hidden or displayed depending on if the user is logged in or not, which will be a basic "Click here to register" if user is not logged in and show some basic user info if they are logged in.

How exactly can I achieve this?
I assume I can't put PHP in the templates file themselves as it's HTML and all that, so...?

Thanks for any help.  Toungue
This could be done with either Template Conditionals or a plugin. See what I've written below if you're going to be using conditionals.

<if $mybb->user['uid'] == 0 then>
    Stuff that you want shown to logged out users goes here.
<else>
    Stuff that you want shown to logged in users goes here.
</if>

Plugin download: http://mybbhacks.zingaburga.com/showthread.php?tid=260
Support thread: https://community.mybb.com/thread-31860.html
Worked perfectly!

Thanks a tonne man.