Home

Your premium source for custom modification services for phpBB
  logo

HomeForumsBlogMOD ManagerFAQSearchRegisterLogin

Comments November 14, 2006

One down, more to go…

Filed under: phpBB — Dave Rathbun @ 12:48 am  

Tonight I closed the BETA for “Forum Auth by Post Count” and declared it to be a release candidate. I submitted it to the MOD Team for approval. One interesting thing came about during the process, at the very last minute I discovered a bug. :shock: Not a huge one, but not one that had been reported yet either.

Brief background: there are plenty of requests out there that are looking to grant (or revoke) access to forums based on post counts. I can certainly see why it’s a popular request as there are all sorts of reasons why this could be interesting and useful.

The current solutions generally revolve around creating a private forum, creating a group to access that private forum, and then using one of several “auto join group” MODs that are floating around. The problem? Lots of overhead. Every single time a user post count can change you have to check to see if they should be added to or removed from a group. That means lots of extra queries, and lots of extra queries are not good.

One of my clients had a problem with “watched topics” and “favorite topics” going missing, and I really believe it was related to an auto-group MOD. Although I never tracked down the exact issue, when we removed the auto-group MOD during a major overhaul the problem stopped.

So anyway, this MOD will provide a much more efficient solution to the permissions issue, as permissions are based on the post count rather than group membership. Why is this more efficient?

Because at any given time I know what the user’s post count is, simply by referencing the $userdata[] array. I don’t need to run any queries to get that information. Also on appropriate pages (index, viewforum, viewtopic) the standard code is already querying the phpbb_forums table, so all I have to do is add my new fields to the end of an existing query and I’m all done. No new queries.

The actual check for the post-based authorization is performed by a new function that I add into the includes/functions.php code. When do you decide to add to an existing file versus include a new one? In this case there was only one new function, and I was already making a change to includes/functions.php in order to fix the “jump box” code, so I decided to tag my code at the end.

After the installation, a board owner can set a minimum and maximum allowed post count to view or post in a forum on their board. The post count auth is performed after the user is already passed the standard auth test, so even a high post count won’t magically allow a normal user to post in a “Moderator Only” forum, it just doesn’t work that way.

The view limits are checked in index.php, viewforum.php, and of course viewtopic.php. The list of forums is altered in the jump box, and the search.php code is also altered so you can’t see search results in forums that you’re not auth’d to see by your post count. I think it’s a nice MOD, and I hope folks find it useful.

Oh, and the bug? Seems that my update to posting.php had a flaw… not only did it prevent you from posting new topics or posts once you had exceeded the post count, it also prevented you from deleting your last post. :-) That bug was fixed easily enough, and the updated code was submitted to the MOD Team for their approval earlier this evening.

So that’s one MOD down, several more to go. My next target for submissions is the Page Permissions MOD. 8)

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Tags allowed in comments:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Confirm submission by clicking only the marked checkbox:

 **             

Powered by WordPress