Jump to the post that solved this thread.
Solved: 5 Years, 4 Months, 1 Week ago How to display element if user logged in?
#1
Solved: 5 Years, 4 Months, 1 Week ago
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
Reply
#2
Solved: 5 Years, 4 Months, 1 Week ago
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
Reply
#3
Solved: 5 Years, 4 Months, 1 Week ago
Worked perfectly!

Thanks a tonne man.
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)