MyBB Community Forums

Full Version: How to hide forum threads unless post count is X
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm trying to figure out a way so that users of a certain usergroup must have X number of posts before viewing a thread.

They should still be able to view the threads list, but when they open I'd like it to say a custom message if possible to.

Like "You need X posts to view threads in this forum, please do not make spam posts, X number of HQ posts is required" or something like that.
Check whether this plugin is doing what you want:

http://community.mybb.com/thread-144715....hide+until
(2015-08-26, 03:50 PM)Ad Bakker Wrote: [ -> ]Check whether this plugin is doing what you want:

http://community.mybb.com/thread-144715....hide+until

I already have that, that is NOT what I want.

That makes it so once they reply they can see content.

I want it so certain usergroups must have for example 10 posts before they can view threads inside the "OFF - Topic" section. But they should still be able to browse the thread list, just not open any threads.
Then you need a new plugin for that. But few people will still be prepared to invest time into products for MyBB 1.6, with MyBB 2.0 on the horizon.
I think you have to use Template Conditionals.

If I understand well what you want, the code should be:


- In showthread, after {$header} :

<if $mybb->user['usergroup'] == X && $mybb->user['postnum'] < 10 then> You need X posts to view threads in this forum, please do not make spam posts, X number of HQ posts is required
<else>
The normal showthread code
</if>

If user is in the usergroup X and he has less than 10 posts in all forums, then he will see message.

Put this code in showthread only and not in forumdisplay_thread, so all users will can see thread list.

Link: http://mybbhacks.zingaburga.com/showthread.php?tid=464
(2015-08-26, 06:56 PM)niere8 Wrote: [ -> ]I think you have to use Template Conditionals.

If I understand well what you want, the code should be:


- In showthread, after {$header} :

<if $mybb->user['usergroup'] == X && $mybb->user['postnum'] < 10 then> You need X posts to view threads in this forum, please do not make spam posts, X number of HQ posts is required
<else>
The normal showthread code
</if>

If user is in the usergroup X and he has less than 10 posts in all forums, then he will see message.

Put this code in showthread only and not in forumdisplay_thread, so all users will can see thread list.

Link: http://mybbhacks.zingaburga.com/showthread.php?tid=464

If its in the template, wouldn't that be for EVERY forum...? Which would mean no one could post anywhere?
(2015-08-27, 12:52 PM)soulfoam Wrote: [ -> ]If its in the template, wouldn't that be for EVERY forum...? Which would mean no one could post anywhere?

You can use it only on a specific forum ID or for every forum.

If only for a specific forum try:


<if $mybb->user['usergroup'] == X && $mybb->user['postnum'] < 10 && $GLOBALS['fid'] == X then> You need X posts to view threads in this forum, please do not make spam posts, X number of HQ posts is required
<else>
The normal showthread code
</if>

$mybb->user['usergroup'] == X  is the usergroup

$mybb->user['postnum'] < 10  need minimum 10 posts on the whole forum

$GLOBALS['fid'] == X  the ID of the forum

I advise you to set the right usergroup and the promotion of groups. For example call usergroups : "Members registered" from 0 to 2 posts, "Users" from 3 to 50 posts, "Experts" from 51 posts to 100 posts and so on or how you want.

In this way you can easily check the permissions and also more easy for Template Conditionals.

For usergroup number ID:

Quote:Go to ACP>User and Groups>Groups> Pick the group you are looking for and in the URL look for a number after GID, that number is the group ID and a FYI gid means group ID.

For example Guests is always 1, if you didn't change it.
(2015-08-27, 01:31 PM)niere8 Wrote: [ -> ]
(2015-08-27, 12:52 PM)soulfoam Wrote: [ -> ]If its in the template, wouldn't that be for EVERY forum...? Which would mean no one could post anywhere?

You can use it only on a specific forum ID or for every forum.

If only for a specific forum try:


<if $mybb->user['usergroup'] == X && $mybb->user['postnum'] < 10 && $GLOBALS['fid'] == X then> You need X posts to view threads in this forum, please do not make spam posts, X number of HQ posts is required
<else>
The normal showthread code
</if>

$mybb->user['usergroup'] == X  is the usergroup

$mybb->user['postnum'] < 10  need minimum 10 posts on the whole forum

$GLOBALS['fid'] == X  the ID of the forum

I advise you to set the right usergroup and the promotion of groups. For example call usergroups : "Members registered" from 0 to 2 posts, "Users" from 3 to 50 posts, "Experts" from 51 posts to 100 posts and so on or how you want.

In this way you can easily check the permissions and also more easy for Template Conditionals.

For usergroup number ID:

Quote:Go to ACP>User and Groups>Groups> Pick the group you are looking for and in the URL look for a number after GID, that number is the group ID and a FYI gid means group ID.

For example Guests is always 1, if you didn't change it.

Thanks so much for that post. I'll try it Smile.

Also promotions don't work because if you allow viewing they can see threads, but if you take away viewing they can't see the forum at all..

I want them to be able to see the forum is there, and all the threads names and stuff, but don't want them to actually be able to open the threads inside that forum.