MyBB Hacks

Full Version: Template Conditionals | If Under X Posts Show Div
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

I'd like to make a template code say If User has less than 10 posts then set .underPostNotification visible to inline else then set to none.

Basically, I'd like to show users a message if they have under 10 posts (to warn them about spamming is not tolerated and remind them of posting rules)

I haven't seen any in-depth tutorials on how to use Template Conditionals.
I have knowledge of CSS, JS, HTML, and PHP. I'm also familiar with how the MyBB template system works.

If someone could point me to an in-depth tutorial or give me some tips on how to do this that would be awesome!

Here is a quick code I whipped up from some posts I've seen.

PHP Code:
 <if $mybb->user['postnum'] >= 9 then>
// Not sure what to put here but it should set the Visble to Inline (Visible)
<else>
// Not sure what to put here but it should set the Visble to None (Disapear)
</if>


Thanks,
DrBaja

There are some ways to do it, depends on how the layout.
But the most important thing is your conditional above.

Simple example:

Code:
<if $mybb->user['postnum'] < 10 then>
	<div class="underPostNotification">Message here</div>
</if>


The div and the massage will be displayed only for the users who have posts less than 10.

Reference URL's