phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

[RELEASED] Forum Auth by Post Count


 
Search this topic... | Search MOD Development... | Search Box
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Author Message
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 656
Location: Texas


flag
PostPosted: Thu Dec 11, 2008 4:33 am 
Post subject: Forum Auth by Post Count

This MOD has been validated and released at phpbb.com. I am copying the text of the first few posts here. Note that this MOD will be moved into the MOD Releases forum once the MOD Catalog is complete.

MOD Name: Forum Auth by Post Count
Author: drathbun
MOD Description: Control access to view / post in forums based on a user's post count.

MOD Version: 1.0.0
Tested on phpBB Version: 2.0.21

As part of the review process the MOD Validator noted this:
Quote:

WHERE 1 = 1?
Code:
         $sql = 'SELECT  forum_id
            ,       min_posts_to_view
            ,       max_posts_to_view
            FROM    ' . FORUMS_TABLE . ' f
            WHERE   1 = 1 ' .
               $extra_sql;


The "1 = 1" portion of the query panel is there so that I always know that there is a where clause, and the $extra_sql variable can then automatically start with AND. If not, then I have to do a bunch of extra checking. So this is a simple shortcut that allows me to generate extra sql (thus the name $extra_sql) on the fly without worrying about whether it is the first line of extra sql (thus requiring a "where") or a subsequent line (requiring an AND instead).

It should perform fine on all databases supported by phpBB.

Another MOD comment was regarding one of the debug messages, where the $sql variable was not echoed. That point is well taken, and I will post an update to fix that shortly. It does not impact the function or security aspects of this MOD.

Screen Shot of Admin Panel
To invoke this MOD, open your admin control panel (ACP) and select Management in the Forum Admin section. Click the Edit link on any forum you wish to protect with this MOD, and set the values as desired. Note that the minimum post count defaults to zero and the maximum post count defaults to minus one. A value of minus one for the maximum value says "no limit has been set".

Image link

FAQ
How can I use the "Visible on Index" feature shown in the screenshot? When I install the MOD I don't seem to get that option...
The "Visible on Index" option displayed in the screenshot above is not a part of this MOD but something different altogether. This MOD - as written - will hide the forum on the index page and prevent someone from viewing it unless they have the required number of posts. Only the items outlined in red are actually from this MOD. The Visible on Index is from an unreleased MOD, and the Enable Topic Points is from another MOD currently in development.

Oh, rats. I want to show the forum on the index, but still prevent people from reading it until they have the required number of posts.
If you want to show the forums on your index but still want to prevent people from reading topics within the forum until they have the correct number of posts, then simply skip the application of the MOD steps pertaining to index.php. You need to apply every other step except those related to that file.

Will this work for Simple Subforums?
Not as written in the download package, no. There should be a fairly simple change in order to make that work, but I have not had time to review it or post it yet.

I would like the permissions message to state how many posts are required to enter the forum.
Sorry, I don't. icon_smile.gif The idea is that the forum doesn't even exist anywhere until the required number of posts have been obtained. In other words, unless a user simply goes through all of the possible forum_id values they should not even know that it's there. In that case, there's no point in telling them how many spam posts they have to enter before gaining access to the forum.

I installed with EasyMOD and now I get a SQL error on viewtopic.php, what can I do?
EasyMOD does not find spaces at the end of a line. There is one edit where the space is quite important. To fix this, please open viewtopic.php and find the following
Code:
f.max_posts_to_viewORDER BY p.post_id ASC


and replace it with this:
Code:
f.max_posts_to_view ORDER BY p.post_id ASC


Do you have translations?
Here are some links to posts within this topic where folks have posted translations, listed in alphabetical order:

Dutch
German
Korean



forum_auth_by_post_count.1.0.0.zip
 Description:
MOD Install File (zipped)

Download
 Filename:  forum_auth_by_post_count.1.0.0.zip
 Filesize:  5.16 KB
 Downloaded:  776 Time(s)


_________________
phpBBDoctor Blog
Back to top
hoimyr
Board Member



Joined: 16 Apr 2009

Posts: 115
Location: Oslo


flag
PostPosted: Sat Dec 10, 2011 10:57 pm 
Post subject: Re: Forum Auth by Post Count

Nice mod. But i have Simple Subforums on my board. Will it crash everything?
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 656
Location: Texas


flag
PostPosted: Sun Dec 11, 2011 3:10 pm 
Post subject: Re: Forum Auth by Post Count

drathbun wrote:
Will this work for Simple Subforums?
Not as written in the download package, no. There should be a fairly simple change in order to make that work, but I have not had time to review it or post it yet.

_________________
phpBBDoctor Blog
Back to top
hoimyr
Board Member



Joined: 16 Apr 2009

Posts: 115
Location: Oslo


flag
PostPosted: Sun Dec 11, 2011 10:53 pm 
Post subject: Re: Forum Auth by Post Count

Yes i just hoped it worked:) i am no coder but i can give it a try..
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0297 seconds using 17 queries. (SQL 0.0027 Parse 0.0024 Other 0.0245)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo