MyBB Community Forums

Full Version: Show Certain Things Depending On If User Is Logged In or Out
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Say I stuck like
<p>Hello there guest!</p>
somewhere randomly in like the header template, how would I make it to where that message would only be displayed to guests or vice versa?
I'm obviously not using that specific thing, since MyBB already shows a message like that by default, that's just an example.
Help is appreciated!
(2012-01-17, 02:22 AM)mbw227 Wrote: [ -> ]Say I stuck like
<p>Hello there guest!</p>
somewhere randomly in like the header template, how would I make it to where that message would only be displayed to guests or vice versa?
I'm obviously not using that specific thing, since MyBB already shows a message like that by default, that's just an example.
Help is appreciated!

perhaps the code would be better suited in the welcome block template (welcome block guest) rather than just randomly placed. This assumes that you would want the message displayed to Guests (only) on every page load.. but as you say this is just a random example it is very difficult to give you an answer
Here is what I want:
<ul id="note">
    <li id="note">
      <a href="#">
        <h2 id="note">Stuff</h2>
        <p id="note">More stuff</p>
      </a>
    </li></ul>
Anyways, I have a specific spot I want that to be displayed for guests. I've got it placed there, but how would I go about making it to where only guests see that?
(2012-01-17, 04:12 AM)mbw227 Wrote: [ -> ]Here is what I want:
<ul id="note">
    <li id="note">
      <a href="#">
        <h2 id="note">Stuff</h2>
        <p id="note">More stuff</p>
      </a>
    </li></ul>
Anyways, I have a specific spot I want that to be displayed for guests. I've got it placed there, but how would I go about making it to where only guests see that?

complex code to show some text ! if you want it in he header add it to welcome_block_guest template if it does not appear in the right place you may have to re write the header & welcomeblock templates or you could add the template conditionals plugin and add an <if> statement where you need it
(2012-01-17, 04:24 AM)JimR Wrote: [ -> ]
(2012-01-17, 04:12 AM)mbw227 Wrote: [ -> ]Here is what I want:
<ul id="note">
    <li id="note">
      <a href="#">
        <h2 id="note">Stuff</h2>
        <p id="note">More stuff</p>
      </a>
    </li></ul>
Anyways, I have a specific spot I want that to be displayed for guests. I've got it placed there, but how would I go about making it to where only guests see that?

complex code to show some text ! if you want it in he header add it to welcome_block_guest template if it does not appear in the right place you may have to re write the header & welcomeblock templates or you could add the template conditionals plugin and add an <if> statement where you need it

Well all that is styled by CSS to look like a sticky note, but not the point.
And thanks, I'll check it out.
Sweet! I actually used the PHP in Templates plugin instead, was on the same page. Worked perfectly, thank you!!

PHP in Templates plugin: http://mybbhacks.zingaburga.com/showthread.php?tid=260