MyBB Community Forums

Full Version: Only show if user is signed in?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have some text I'd only like visible if the user is signed in. Does the template system have "if" statements?

Thanks
It's for a theme I plan on redistributing. I was hoping it'd be simpler than that.
I think by default, we can't use a conditional in mybb template system.
By default it's not that easy. You could do something like Yumi suggested in another thread; use CSS to show and hide based on surrounding DIVs. For example;

Put your welcomeblock in the header_welcomeblock_member template wrapped in, say <div class="welcomeblock">. Underneath, place the text you want shown to logged in users in <div class="usertext">.

Wherever you want the welcomeblock to show, wrap the {$welcomeblock} in #panel. Wherever you want the other stuff to show, wrap in #usertext. You'd probably need to keep this stuff in the header template, as I don't believe $welcomeblock is global, though it may be.

And then, the CSS:
#panel .usertext {
  display: none;
}

#usertext .welcomeblock {
  display: none;
}

Should work, though there'll be lots of extra HTML laying around unused.