MyBB Community Forums

Full Version: MyBB IF statements?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

Is there a list of the available MyBB IF statements?

I'm trying to look for one where I can show a message to users with less than 10 posts, if there a if statement or something I can use for this?

and what would I use so only registered users can view the page and guests get a no perms page..?

Thanks
MyBB uses templates system and at present if statements cannot be used directly.
there is a plugin to use if conditions. see this for more details

guests can view thread titles only plugin can be used for the third purpose
and/or you can also edit guests group permissions
Try these:

if($mybb->user['uid'] > 0 && $mybb->user['postnum'] < 10)
{
    // User is logged in and has less than 10 posts
}

if($mybb->user['uid'] == 0)
{
    error_no_permission();
}

There isn't a list available because the possibilities are endless. With PHP, you can do what you like with the data.
Hello,

Thanks for the response.

How would I implement these into something that isn't in templates, like I am using http://www.thephilippinescentral.tk/Thre...x-New-Page

but I want it so it shows a notice to users who don't have 10 posts & also a no perm error to guests or banned etc.

Any idea how I would do this or would this be easier with this template condition plugin?
You're looking for something like this:

if ($mybb->user['postnum'] < 10 || $mybb->user['usergroup'] == 7) error_no_permission(); 
// alternatively custom error with error("bla bla") function

Place it after the breadcrumb code.