[MODDB] Approval MOD

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

[MODDB] Approval MOD

Post by uncle.f » Mon Sep 04, 2006 7:19 pm

MOD Title: Approval MOD
MOD Description: All posts made by non-moderator users must be validated by a moderator before becoming available for general viewing. If you want to approve posts only from certain users, see this MOD.

MOD Version: 1.0.0a.

Note: this MOD has been validated and further support will be given in this topic.

Known bugs: None
Easy MOD Friendly: Yes

MOD Download: approval_mod_1.0.0a.zip

Demo Board: Link
Demo Usernames: user or user2 for an ordinary user, mod for a moderator, admin for an admin
Demo Passwords: same as the usernames


RELEASE HISTORY

2006-10-22 - Version 1.0.0a - Validated by MOD Database Admin
- Replaced hardcoded English with a language variable (MOD PM notification subject)
- Added custom CSS style into subSilver.css (same as in overall_header.tpl)
- Corrected malformed <br> tag in the "successful approval confirmation page"
- Repackaged files to conform to MOD standards

2006-09-10 - Version 0.9.9-RC3
- Two new SQL queries during MOD installation to fix the "missing existing posts" problem
- Topic Review window now follows the same approval rules as the main topic view
- Approved posts that are edited by standard users become unapproved (when approval is enabled)
- Moderators PM notification is now aware of the "Disable Private Messaging" global setting
- Made it impossible to reply to the topic if its first post is unapproved
- Added an entry regarding approval to the main FAQ
- Optimized code, made MOD "less intrusive" and easier to install by hand

2006-09-05 - Version 0.9.9-RC2
- Fixed a bug in viewtopic.php affecting number of topic replies shown to the standard users
- Shortened 'under approval' subject for messages in topic view
- Cosmetic changes in the approval.mod file

2006-09-04 - Version 0.9.9-RC1
- Initial release


MOD SUPPORT, BUGS, FEATURE REQUESTS, ETC

MOD support will be given directly in this topic. You can send me a private message too.
Please do not post long code outputs here!
Should you need to provide one, please send it to me at "avn [dot] soft [at] gmail [dot] com".
Most likely I won't implement any new features that require significant code changes or additions. Sorry.
Smaller suggestions and, of course, the bug reports are always welcome. :wink:


MOD FEATURES OVERVIEW

This MOD allows admins to set an 'Approval' mode for each Forum. If Approval is enabled in a Forum, all posts made by a normal (non-moderator) user in that forum must be validated by a moderator/admin before becoming available for general viewing.

Optionally, it is possible to completely hide unapproved posts from the general viewing before they are approved. In addition, moderators can be notified by e-mail and/or private message every time the post requiring approval is made.

Finally, the moderators' control panel allows mass approval functions if required.


MOD FEATURES IN DETAIL
  • Ability to set per-forum "Approval enabled/disabled" by the admin(s) in the "Forum Management" admin Control Panel. By default all newly created forums have their approval mode set to disabled.
  • Posting behaviour. When the user is making a post in a forum where approval is enabled, the subject and the text of the post are replaced by a generic message stating that the post is awaiting approval. This does not affect admins and moderators who can still see the original posted message (with an additional label that the post has not been approved yet). Also, standard non-anonymous users can still see and edit their own unapproved messages. The unapproved message cannot be quoted in replies (quoting is allowed for the moderators and the original authors of the post). Replying to topic is disabled until topic's first post is approved.
  • Optional user warning. If the standard (non-moderator) user is making a post in the forum where approval is enabled, a warning could be displayed at the top of the new post page during posting. This warns the user that the post contents will not be visible until approved by the moderator. This is per-forum setting and can be turned on or off.
  • Hiding unapproved posts. It is possible to completely hide all the posts that have not yet been approved from viewing by standard users. It means that the standard users won't even see the message that says "This post is awaiting approval". Mods and admins, however, can see all the posts with a special note signifying that the post is awaiting approval but to a standard user it will appear as if no message was posted at all. This also includes Forums/Topics/Posts statistics which will be changed automatically depending on user authorization level, i.e., the mods and admins will see the real number of posts/topics in the forums and topics index (as well as stats for unapproved posts in brackets) while the standard users will only see the number of posts that has been approved and can actually be viewed. Hiding unapproved posts is a 'per-forum' setting.
  • Moderators notification. As soon as the unapproved post is made (or edited) by a standard user an email and/or private message is automatically sent to all of the moderators for a given forum. The message contains a link to the newly made post as well as the whole posted message itself. In additition, the message contains a link which can be used to approve the post directly without reading it in the actual forum. If approval notification is on both by PM and by E-mail and a moderator has "Private Message notification by E-mail" turned on in the user profile, the moderator will only get a Private Message regarding the new post to avoid double e-mailing. Moderators notification is also a 'per-forum' setting.
  • Posts approval. A moderator/administrator has new "approve" button in the topic view which allows approving the post. The button has been designed to match the default subSilver theme, English.
  • Mass approval via Moderator Control Panel. A new "Approve" button is added by this MOD to the "Lock/Unlock/Move/Delete" buttons in the moderators' Control Panel. This allows mass approval of all the posts inside one or more topics with a single click. Moderators can also view the full thread before mass-approving it directly from the Control Panel (in a new browser window opened by clicking on the approval info link).
  • Modified search behaviour. Unapproved topics/posts will not appear in search results even when admin or moderator is searching the forums. A post must be approved to be a part of search result set. This behaviour may be changed in the future if requested by many users.
Here is how the Forum Management panel looks like after the modification:

Image

Forum view with some unapproved posts as viewed by moderator:

Image

Unapproved topic as viewed by a moderator:

Image

Moderator Control Panel view:

Image


MOD COMPATIBILITY

Please consider the following:
  • This MOD has only been tested with the latest available phpBB version 2.0.21. There is absolutely no guarantee it will work on earlier versions. I will not support or address any problems arising from using this MOD with the earlier versions of phpBB.
  • This MOD is fully compatible with the Attachment MOD.
  • This MOD is EasyMOD Friendly. Since the Approval MOD is a fairly complex MOD when it comes to editing your forum files, it is highly recommended to use EasyMOD to install this MOD. This will significantly reduce the chances of making a mistake that could cause general forum malfunction.
  • This MOD has only been tested with MySQL backend. There are some custom SQL queries in the "index.php" page that depend on the database back-end, namely MySQL, Postgresql and Oracle. This MOD changes all of those queries in the "index.php", however, I have no means of testing anything else except MySQL. Still, I believe the queries should work OK on all databases. Please let me know if you are running with non MySQL DB and it works ok (or not).
  • This MOD most likely will NOT work with any other MOD that changes message posting or topic/forum viewing behaviour. The approval functionality is something that affects phpBB quite deeply, so unfortunately that is the price to pay. Sorry :-(
    Some MODs like "Topic display order" by Ptirhiik, for instance, will require tiny adjustment to work together with the Approval MOD. Others may need significant code changes.

ABOUT THIS MOD

I have been looking for the approval functionality in phpBB but could not find any MOD that would suit my requirements. The best MOD I could locate was called "Approve Post". That was OK for a while (although it had "too many features" for my liking) until its development stopped and the MOD became abandoned. Also, after a closer look I found some rather questionable code inside that MOD. :roll:

Then I came across "Freeze Posts" MOD by axe70. It looked really promising and was doing things in a simpler and more effective way than the first MOD I used. Unfortunately, this time it was "too simple" and the full functionality that I needed wasn't quite there. Plus, I needed the working solution ASAP...

As they say, if you can't find what you need make it yourself ;)

So I started writing a MOD for Axe70's MOD :) Very soon I recognized that the functionality I wanted required more fundamental changes in the MOD's logic, especially with the SQL tables structures. I did not want to push "my way of doing things" onto axe70, neither I wanted to rush him, especially because he was actively developing his MOD at the same time with his own ideas. Instead I scrapped my "modded MOD" and wrote the whole thing new.

I still would like to thank axe70 for that "starting point" and would like note that my MOD does not use a single line of his code is written completely from scratch.
Last edited by uncle.f on Mon Nov 06, 2006 2:02 am, edited 32 times in total.

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Mon Sep 04, 2006 9:13 pm

Thank you, thank you, thank you! Although, I'm kind scared as this is in development and I really, really, need this ASAP. Is it safe to install on my live site? Plus I'm quite the noob when it comes to being a forum admin and all.

Regards, Art.

User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Post by uncle.f » Mon Sep 04, 2006 9:27 pm

I am running this MOD in production on my board as I am writing this reply (hence RC1). However, my userbase is rather small and the board importance is not really life and death matter :)

If you do not have any other MODs that modify forum/topic viewing and/or posting behaviour, you should be fine.

I did extensive testing with this MOD before publishing it. However, you never know what may happen in a different user's environment. If there are any bugs to be found it is only better that more users try this MOD. Remember though, this MOD has not been officially "released" or validated by phpBB team.

I highly recommend you to use EasyMOD for this MOD's installation, especially if you are new to these things. Editing files by hand will be long and painful process. It is easy to make a mistake that could break your forum completely.

Please try to check the MOD first on some non-critical test-instance of your forum if possible. It goes without saying that you should back up all of the phpBB related files and SQL databases before putting this (or any other) MOD in production environment.

I have submitted this MOD for validation by the phpBB admins today, but it usually takes some weeks until it is officially validated.
Last edited by uncle.f on Tue Sep 05, 2006 12:10 am, edited 2 times in total.

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Mon Sep 04, 2006 11:56 pm

So I manage a board for a friend of mine. It has the Attachment MOD and uses the Pink Vibes STYLE. It appears that it should be relatively easy to install manually, but if I read everything here in these forum correctly, I can't use EasyMOD once I have installed the Attachment MOD (?)

Thanks, Art.

User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Post by uncle.f » Tue Sep 05, 2006 12:05 am

There is absolutely no reason why you should not be able to install EasyMOD after you have installed the Attachment MOD. I can tell you that the EasyMOD is 100% working when installed after the Attachment MOD.

I install my board exactly like that:
  • Clean install of phpBB 2.0.21
  • Attachment MOD (using premodified files)
  • EasyMOD
  • Approval MOD
  • My other MODs...
So it should definitely work.

As for the additional Style, you have to take care about the modified files in the templates directory. Not sure if EasyMOD does that for you automatically. The approval button also must be changed to correspond to your Style (if required).

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Tue Sep 05, 2006 12:12 am

So I tried out your demo.

In Approve 1
1. It works fine for the first post. I can't see my post (just the generic one) until the post is approved.
2. It also works for replies.

In Approve 2
1. How did you configure the settings. I went in to the admin panel, and I must be blind, I couldn't figure out where the settings were to configure it so you don't even see the post with the generic message.

Thanks again. This appears so great. And sorry for all the dumb questions.

Regards, Art.
Last edited by gr82bart on Tue Sep 05, 2006 12:20 am, edited 2 times in total.

User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Post by uncle.f » Tue Sep 05, 2006 12:17 am

It depends which forum you are posting your messages in.

"Approve 1" forum is currently configured to show ALL messages. However, the text of the message itself is replaced by a notice "This post is awaiting approval from the moderator."

"Approve 2" forum is configured to completely hide the unapproved messages from the ordinary and anonymous users.

To configure the Approve settings, go to the Admin panel and then select "Management" under "Forum Admin". Then press "Edit" on the Forum.

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Tue Sep 05, 2006 12:26 am

D'oh! Yep, I found it.

Thanks very much. I'll be installing it now. Drum roll please .....

Regards, Art.

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Tue Sep 05, 2006 1:53 am

Well, it didn't quite work. Existing posts, prior to me installing the MOD, don't show when signed in as a normal user (after I configure the forum settings to require approval) , but when I go in as an admin, the posts are there but I don't have the opportunity to 'approve' them!

Regards, Art.

User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Post by uncle.f » Tue Sep 05, 2006 2:42 am

Existing posts, prior to me installing the MOD, don't show when signed in as a normal user


Prior = before. So, your "existing posts are not shown BEFORE you install this MOD"? Or after? I am sorry, but I am not sure what you mean by this.

Additionally, I have a suspicion you are editing your files manually ;) Is it so?
If yes, then I am afraid you have to double check and triple check your edits. There are many IN-LINE statements in the MOD where it is very easy to confuse things.

Once again I strongly recommend that you use EasyMOD for installing this MOD.

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Tue Sep 05, 2006 4:11 pm

uncle.f wrote: Prior = before. So, your "existing posts are not shown BEFORE you install this MOD"? Or after? I am sorry, but I am not sure what you mean by this.
Sorry, to be clear (I hope): The posts that were already posted before I installed the Approval MOD either do not show or or have the "need to approve" message depending on how I configure my settings. When I go in as the admin, I can't approve them - that is, there is no 'approve button' to do so.

Test posts that I made after the installation work fine. The 'approve button' is there for me to approve the post, just as in your demo website.
Additionally, I have a suspicion you are editing your files manually ;) Is it so?
I am using EasyMOD.

Thanks, Art.

User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Post by uncle.f » Tue Sep 05, 2006 5:55 pm

Several questions to you:

Which versions of PHP and EasyMOD are you running? Which database (MySQL/Postgresql/Oracle/MSSQL) are you using?

What happens to those disappeared posts if you go to the Admin CP and uncheck the "Enable Approval System" box? Does everything then work exactly as before installing the Approval MOD or the posts are still missing?

Lastly, are you running only this: phpBB 2.0.21 + Attachment MOD 2.4.4 + Pink Vibes Style? Nothing else? No other modifications / patches?

It is absolutely strange that your old posts (the ones you had there before installing the Approval MOD) appear as unapproved, because they should automatically get the "approved" status when you execute SQL queries during the MOD installation. (see the default '0' part in the SQL queries?)

EDIT: Thinking of SQL queries....I just had an idea on why this stuff may not work for you!

I think 2 crucial queries are missing in the MOD installation routine!! So we have an "installation bug". During the new installation on a live board (with the existing posts) 2 more queries must be executed:

Code: Select all

UPDATE phpbb_topics SET topic_last_post_approved = topic_last_post_id;

UPDATE phpbb_forums SET forum_last_post_approved = forum_last_post_id;
But because you have already made SQL changes (and made some posts afterwards) I recommend that you try running these SQL queries on your board:

Code: Select all

UPDATE phpbb_topics SET topic_last_post_approved = topic_last_post_id, topic_approve = 0, topic_replies_unapproved = 0;

UPDATE phpbb_forums SET forum_last_post_approved = forum_last_post_id, forum_posts_unapproved = 0, forum_topics_unapproved = 0, forum_approve = 0;

UPDATE phpbb_posts SET post_approve = 0;
These last 3 queries should complete clear the "unapproved" posts status. After that you can enable approval again via the Admin CP and hopefully it works OK then.

Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f » Tue Sep 05, 2006 6:24 pm

Very nice work uncle.f. I'm watching you! :lol:

Regards,
Wolf

gr82bart
Registered User
Posts: 29
Joined: Sat Apr 30, 2005 12:51 pm

Post by gr82bart » Tue Sep 05, 2006 10:17 pm

uncle.f wrote: Which versions of PHP and EasyMOD are you running? Which database (MySQL/Postgresql/Oracle/MSSQL) are you using?
phpBB - 2.0.21
EasyMOD - v0.3.0 Beta
MySQL 4.0
What happens to those disappeared posts if you go to the Admin CP and uncheck the "Enable Approval System" box? Does everything then work exactly as before installing the Approval MOD or the posts are still missing?
The posts come back.
Lastly, are you running only this: phpBB 2.0.21 + Attachment MOD 2.4.4 + Pink Vibes Style? Nothing else? No other modifications / patches?
That's correct.
It is absolutely strange that your old posts (the ones you had there before installing the Approval MOD) appear as unapproved, because they should automatically get the "approved" status when you execute SQL queries during the MOD installation. (see the default '0' part in the SQL queries?)
OK whatever you say....? 8O
EDIT: Thinking of SQL queries....I just had an idea on why this stuff may not work for you!

I think 2 crucial queries are missing in the MOD installation routine!! So we have an "installation bug". During the new installation on a live board (with the existing posts) 2 more queries must be executed:

Code: Select all

UPDATE phpbb_topics SET topic_last_post_approved = topic_last_post_id;

UPDATE phpbb_forums SET forum_last_post_approved = forum_last_post_id;
But because you have already made SQL changes (and made some posts afterwards) I recommend that you try running these SQL queries on your board:

Code: Select all

UPDATE phpbb_topics SET topic_last_post_approved = topic_last_post_id, topic_approve = 0, topic_replies_unapproved = 0;

UPDATE phpbb_forums SET forum_last_post_approved = forum_last_post_id, forum_posts_unapproved = 0, forum_topics_unapproved = 0, forum_approve = 0;

UPDATE phpbb_posts SET post_approve = 0;
These last 3 queries should complete clear the "unapproved" posts status. After that you can enable approval again via the Admin CP and hopefully it works OK then.
Ummmm....talk to me in English. Really, really simple English. What exactly am I suppose to do? Colour by numbers works best for me!

Thanks, Art.

User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Post by uncle.f » Tue Sep 05, 2006 11:05 pm

Have you ever used phpMyAdmin before?

You need to execute SQL queries directly on your SQL database. :-)
phpMyAdmin is the best for this purpose.

Locked

Return to “[2.0.x] MODs in Development”