[BETA] Post Control / 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.
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Post by sbourdon »

Hello,

Would you like your moderators to be notified of newly posted messages awaiting validation in forums for which they are responsible? Here's the add-on you need! ;)

Code: Select all

#
#-----[ OPEN ]---------------------------------------------
#
   ROOT/includes/functions_post.php

#
#-----[ FIND ]---------------------------------------------
#
	if ($mode != 'editpost')
	{
		$post_id = $db->sql_nextid();

#
#-----[ AFTER, ADD ]-----
#
		//the following code was added by brett (aka: minorgod) to improve the post control mod and alert moderators that a new post needs moderating 
		
		if ( $userdata['user_id'] == ANONYMOUS || $board_config['post_control_users'] == "1" && $userdata['user_level'] == USER || $board_config['post_control_edited'] == "1" && $userdata['user_level'] == USER )
		{          
         //see if we're logged into an admin session and if so, skip the notification completely 
         if(!$userdata['session_admin']){ 
          
               $sql =    "SELECT user_email, user_lang 
                     FROM " . USERS_TABLE . " 
                     WHERE user_level = " . ADMIN; 
                  
               if ( !($result = $db->sql_query($sql)) ){ 
                  message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql); 
               } 
                
               // Now grab the admin addresses to see if our current poster is in the list of admin recipients. 
               // I couldn't figure out a quicker way to do this using the PHPbb DB abstraction functions. If 
               // we were using PEAR DB (which we really SHOULD be), then I could have just said 
               // $admin_email_address_list = $db->getAll($query); but since we're not using PEAR and PHPbb has 
               // no equivalent function, we must get the records and loop through them old-school style. LAME. 
               $sql = "SELECT user_email 
                    FROM " . USERS_TABLE . " 
                    WHERE user_level = " . ADMIN; 
               $admin_email_addresses = $db->sql_query($sql); 
               while($address_row = $db->sql_fetchrow($admin_email_addresses)){ 
                  $admin_email_address_list[] = $address_row['user_email']; 
               } 

               $db->sql_freeresult($admin_email_addresses); 

               //now do the emailing only if the user is not in the admin address list 
               if( empty($userdata['user_email']) || !in_array($userdata['user_email'],$admin_email_address_list)){ 
                  while ($row = $db->sql_fetchrow($result)){ 
                     include_once($phpbb_root_path . 'includes/emailer.'.$phpEx); 
                     $emailer = new emailer($board_config['smtp_delivery']); 
                     $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path'])); 
                     $script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx; 
                     $server_name = trim($board_config['server_name']); 
                     $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; 
                     $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/'; 
                     $post_control_subject = str_replace("''", "'", $post_subject);
                     $emailer->from($board_config['board_email']); 
                     $emailer->replyto($board_config['board_email']);       
                     $emailer->email_address(trim($row['user_email'])); 
                     $emailer->use_template("post_control_notify", $row['user_lang']); 
                     $emailer->set_subject("New Post Requires Authorization"); 
                     $emailer->assign_vars(array( 
                        'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 
                        'SITENAME' => $board_config['sitename'], 
                        'SUBJECT' => (!empty($post_control_subject)) ? '- ' . $post_control_subject : '',
                        'TOPIC_TITLE' => (!empty($post_control_subject)) ? '(' . $post_control_subject . ') ' : '', 
                        'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=$post_id#$post_id" 
                        ) 
                     ); 
                     $emailer->send(); 
                     $emailer->reset(); 
                   
                  }//end while ($row = $db->sql_fetchrow($result)){ 
               }//end if( empty($userdata['user_email']) || !in_array($userdata['user_email'],$admin_email_address_list)) 
                
               $db->sql_freeresult($result); 
    
         } 
		}         
      //end code added by brett (aka: minorgod) to improve the post control mod and alert moderators that a new post needs moderating

#
#-----[ CREATE ]---------------------------------------------
#
   ROOT/language/lang_english/email/post_control_notify.tpl

#
#-----[ PASTE THE FOLLOWING ]---------------------------------------------
#
Subject: New Post Requiring Approval {SUBJECT} 
Charset: iso-8859-1 

Hello, 

You are receiving this email because a new post {TOPIC_TITLE}is requiring approval on {SITENAME}.
You can use the following link to validate or invalidate this post: 

{U_TOPIC}

{EMAIL_SIG}

#
#-----[ CREER ]---------------------------------------------
#
   ROOT/language/lang_french/email/post_control_notify.tpl

#
#-----[ COPIER LE TEXTE SUIVANT ]---------------------------------------------
#
Subject: Message en attente de validation {SUBJECT} 
Charset: iso-8859-1 

Bonjour, 

Vous recevez ce courriel parce qu'un nouveau message {TOPIC_TITLE}est en attente de validation sur {SITENAME}.
Vous pouvez utiliser le lien suivant pour valider ou invalider le message: 

{U_TOPIC}

{EMAIL_SIG}
Please, test and report back!


Happy new year! :D
Last edited by sbourdon on Mon Apr 09, 2007 6:35 pm, edited 2 times in total.
ipodmods
Registered User
Posts: 14
Joined: Thu Jul 27, 2006 5:18 pm

Post by ipodmods »

I appreciate your addition, but that's not really what we're looking for. We really want to avoid the need to have moderators approve each post.

We want someone to be able to join the BB, then make a post or two, but their post would not go public until the mods have reviewed and approved them. (which is where it is the same..) the difference is,

Once a user already has "x" number of "approved" post by the mods, then his/her posts no longer wait approval and are displayed immediately.

This way, SPAM posts never make it up, but legitimate posters only deal with the hassle of waiting to post once (or x number of times.)
B Bauer
Registered User
Posts: 10
Joined: Mon Mar 27, 2006 6:36 pm

"Click Here to view your message"

Post by B Bauer »

Hi,

Im in the process of rebuilding a forum and I've applied the Post Control mod. Now though, I have a problem. $phpEx is not getting inserted correctly into the following urls:

Code: Select all

			<tr>

				<td align="center"><span class="gen">Your message has been entered successfully.<br /><br />But Posts Validation have been activated; therefore, your message has to be approved by the webmaster or a moderator before appearing online.<br /><br />Click <a href="viewtopic.?post_post_url=10#10">Here</a> to view your message<br /><br />Click <a href="viewforum.?post_forum_url=1">Here</a> to return to the forum</span></td>
			</tr>
The meta refresh url has the same problem.

I reverted to a backup from immediately before the Post Control mod, and the links work there, its only after adding this mod that I seem to encounter this problem.

Does anyone else have this problem, and/or a cure?
B Bauer
Registered User
Posts: 10
Joined: Mon Mar 27, 2006 6:36 pm

Re: "Click Here to view your message"

Post by B Bauer »

I started back again from immediately before Post Control and reinstalled it, and I get the same problem.

Additionally I have found that as soon as I apply the changes to template: /admin/board_config_body.tpl all of the radios on the Configuration panel refuse to display as checked. I can revert the template only and the radios display fine, its something about those two small changes that causes it to puke.

Configuration is fresh install of phpBB2.0.22, attachment mod, easymod, and rss mod.

Can anyone please help? I really need the ability to moderate all posts.

:(
B Bauer wrote: Hi,

Im in the process of rebuilding a forum and I've applied the Post Control mod. Now though, I have a problem. $phpEx is not getting inserted correctly into the following urls:

Code: Select all

			<tr>

				<td align="center"><span class="gen">Your message has been entered successfully.<br /><br />But Posts Validation have been activated; therefore, your message has to be approved by the webmaster or a moderator before appearing online.<br /><br />Click <a href="viewtopic.?post_post_url=10#10">Here</a> to view your message<br /><br />Click <a href="viewforum.?post_forum_url=1">Here</a> to return to the forum</span></td>
			</tr>
The meta refresh url has the same problem.

I reverted to a backup from immediately before the Post Control mod, and the links work there, its only after adding this mod that I seem to encounter this problem.

Does anyone else have this problem, and/or a cure?
B Bauer
Registered User
Posts: 10
Joined: Mon Mar 27, 2006 6:36 pm

Re: "Click Here to view your message"

Post by B Bauer »

B Bauer wrote: Additionally I have found that as soon as I apply the changes to template: /admin/board_config_body.tpl all of the radios on the Configuration panel refuse to display as checked. I can revert the template only and the radios display fine, its something about those two small changes that causes it to puke.


Figures right after I post I would find the cure for this. I was viewing the instructions in Dreamweaver, which was converting some UPPERCASE variables to lowercase. Grr...

From:

Code: Select all

	<tr>
		<td class="row1">{L_POST_CONTROL_USERS}</td>
		<td class="row2"><input type="radio" name="post_control_users" value="1" {POST_CONTROL_USERS_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="post_control_users" value="0" {POST_CONTROL_USERS_NO} /> {L_NO}</td>
	</tr>   
	<tr>
		<td class="row1">{L_POST_CONTROL_EDITED}</td>
		<td class="row2"><input type="radio" name="post_control_edited" value="1" {POST_CONTROL_EDITED_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="post_control_edited" value="0" {POST_CONTROL_EDITED_NO} /> {L_NO}</td>
	</tr>
To (notice the vars in lowercase)

Code: Select all

	<tr>
		<td class="row1">{L_POST_CONTROL_USERS}</td>
		<td class="row2"><input type="radio" name="post_control_users" value="1" {post_control_users_yes} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="post_control_users" value="0" {post_control_users_no} /> {L_NO}</td>
	</tr>   
	<tr>
		<td class="row1">{L_POST_CONTROL_EDITED}</td>
		<td class="row2"><input type="radio" name="post_control_edited" value="1" {post_control_edited_yes} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="post_control_edited" value="0" {post_control_edited_no} /> {L_NO}</td>
	</tr>


So... I guess I now get to see if the other noted issue is caused by the same problem.


Appologies for the false alarm.
B Bauer
Registered User
Posts: 10
Joined: Mon Mar 27, 2006 6:36 pm

Re: "Click Here to view your message"

Post by B Bauer »

B Bauer wrote: So... I guess I now get to see if the other noted issue is caused by the same problem.


Unfortunately the 'Click Here to view your post' issue still exists. I reapplied the Post Control 0.26 (using a text editor) to ensure it wasnt an issue with letter case.

One additional thing I noticed is that if I attempt to correct the url by placing ".php" where it should be, it just displays a message that the post does not exist. But I should be able to view my own posts, right? I can browse the group and read my own post, so its just the links on this page that seem messed up.

before Post Control 0.26:

Code: Select all

Your message has been entered successfully.<br />
<br />
Click <a href="viewtopic.php?p=3#3">Here</a> to view your message<br />
<br />
Click <a href="viewforum.php?f=1">Here</a> to return to the forum
after Post Control 0.26

Code: Select all

Your message has been entered successfully.<br>
<br>
But Posts Validation have been activated; therefore, your message has to be approved by the webmaster or a moderator before appearing online.<br>
<br>
Click <a href="viewtopic.?post_post_url=3#3">Here</a> to view your message<br>
<br>
Click <a href="viewforum.?post_forum_url=1">Here</a> to return to the forum
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Post by sbourdon »

Hello,

Since you're the only one reporting those problems, I can only assume that it's being caused by an error on your part...

Please, review the installation instructions carefully and apply every modification using a text editor (such as PSPad); Post Control is a complicated MOD to install so errors can occur. You obviously did something wrong since the <br /> tags also display differently after your modifications...

Good luck!
B Bauer
Registered User
Posts: 10
Joined: Mon Mar 27, 2006 6:36 pm

Re: "Click Here to view your message"

Post by B Bauer »

It turned out it was a case issue, just not with the actual mod code.
B Bauer wrote:
B Bauer wrote:So... I guess I now get to see if the other noted issue is caused by the same problem.


Unfortunately the 'Click Here to view your post' issue still exists. I reapplied the Post Control 0.26 (using a text editor) to ensure it wasnt an issue with letter case.

One additional thing I noticed is that if I attempt to correct the url by placing ".php" where it should be, it just displays a message that the post does not exist. But I should be able to view my own posts, right? I can browse the group and read my own post, so its just the links on this page that seem messed up.

before Post Control 0.26:

Code: Select all

Your message has been entered successfully.<br />
<br />
Click <a href="viewtopic.php?p=3#3">Here</a> to view your message<br />
<br />
Click <a href="viewforum.php?f=1">Here</a> to return to the forum
after Post Control 0.26

Code: Select all

Your message has been entered successfully.<br>
<br>
But Posts Validation have been activated; therefore, your message has to be approved by the webmaster or a moderator before appearing online.<br>
<br>
Click <a href="viewtopic.?post_post_url=3#3">Here</a> to view your message<br>
<br>
Click <a href="viewforum.?post_forum_url=1">Here</a> to return to the forum
Catnip
Registered User
Posts: 1
Joined: Sun Feb 11, 2007 11:56 am

Post by Catnip »

Line 1428

Code: Select all

# 
#-----[ FIND ]------------------------------------------ (Post Control)
#
		<td class="catRight" align="center" valign="middle"><span class="gen">&nbsp</span></td>

# 
#-----[ REPLACE ]------------------------------------------ (Post Control)
#
		<td class="catRight" align="center" valign="middle" colspan="2"><span class="gen">&nbsp</span></td>
You missed the semi colon in &nbsp; nothing ground breaking but I thought I'd let you know.
entilzah
Registered User
Posts: 2
Joined: Mon Feb 12, 2007 5:47 am
Location: Oregon

Can someone direct me where to look?

Post by entilzah »

Hello. After installilng the MOD, I am unable to approve a posting so that it can become live. I can find no link to do so anywhere when I'm logged in as a moderator. And when I'm logged in as a regular user (not the poster), I can see the posting, even though it says it's waiting to be approved. The subject is still hyperlinked and the message still shows.

I missed something or did an insert somewhere that's not right, but I can't figure out what. I went back through the install instructions and double-checked all of my modifications and insertions to make sure I did them all correctly, and as near as I can tell, I did.

Without seeing the code, I know it's impossible to say "That's the problem," but I'm hoping someone might be able to point me to a good place to start, maybe a common problem point. I really don't want to have to go back through this from the start.

Thanks.

So, I went back through it and found two copy-paste errors that resulted in most of the problems I am having. So it's mostly working now.
entilzah
Registered User
Posts: 2
Joined: Mon Feb 12, 2007 5:47 am
Location: Oregon

Lonely icon in forum template header

Post by entilzah »

Hello.

The only thing I'm still seeing that is odd to me, and I don't know if this is a problem or not, is a result, I believe, of the following code

Code: Select all

# 
#-----[ OPEN ]-----------------------------
# 
   ROOT/templates/subSilver/overall_header.tpl

# 
#-----[ FIND ]---------------------------- (Post Control)
#
						&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>&nbsp; &nbsp;<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="{PRIVMSG_IMG}" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>&nbsp; 

# 
#-----[ AFTER, ADD ]------------------------------------------ (Post Control)
#
						<!-- BEGIN is_modo -->
						&nbsp;<a href="{is_modo.U_PC_LIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{is_modo.L_PC_LIST}" hspace="3" />{is_modo.L_PC_LIST}</a>&nbsp;
						<!-- END is_modo -->


I have an icon (the memberlist icon) that is never linked to anything but the current page because the anchor tag is always empty. It also has no text accompanying it. It rests between the PM indicator and the Log In/Out icon.

Here is the code that is produced for that part of the header:

Code: Select all

<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">
							&nbsp;<a href="profile.php?mode=editprofile" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="Profile" hspace="3" />Profile</a>&nbsp; &nbsp;<a href="privmsg.php?folder=inbox" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="You have no new messages" hspace="3" />You have no new messages</a>&nbsp; &nbsp;<a href="" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="" hspace="3" /></a>&nbsp; &nbsp;<a href="login.php?logout=true&sid=9968e7fed131738cebc43b9bc45b0db7" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="Log out [ afterlifebooks ]" hspace="3" />Log out [ afterlifebooks ]</a>&nbsp;
						</span></td>
What is it supposed to be and why is it coming up the way it is for me? Any ideas?

Thank you.
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Post by sbourdon »

Catnip wrote: Line 1428

Code: Select all

# 
#-----[ FIND ]------------------------------------------ (Post Control)
#
		<td class="catRight" align="center" valign="middle"><span class="gen">&nbsp</span></td>

# 
#-----[ REPLACE ]------------------------------------------ (Post Control)
#
		<td class="catRight" align="center" valign="middle" colspan="2"><span class="gen">&nbsp</span></td>
You missed the semi colon in &nbsp; nothing ground breaking but I thought I'd let you know.


Thanks for reporting that! I will include the fix in the next update.
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Re: Lonely icon in forum template header

Post by sbourdon »

entilzah wrote: Here is the code that is produced for that part of the header:

Code: Select all

<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">
							&nbsp;<a href="profile.php?mode=editprofile" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="Profile" hspace="3" />Profile</a>&nbsp; &nbsp;<a href="privmsg.php?folder=inbox" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="You have no new messages" hspace="3" />You have no new messages</a>&nbsp; &nbsp;<a href="" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="" hspace="3" /></a>&nbsp; &nbsp;<a href="login.php?logout=true&sid=9968e7fed131738cebc43b9bc45b0db7" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="Log out [ afterlifebooks ]" hspace="3" />Log out [ afterlifebooks ]</a>&nbsp;
						</span></td>
What is it supposed to be and why is it coming up the way it is for me? Any ideas?

Thank you.


Your code is wrong; please provide the part of the overall_header.tpl file that contains the main menu so we can have a look at it.

Regards,
sbourdon
User avatar
nims
Registered User
Posts: 310
Joined: Sun Aug 13, 2006 12:29 pm
Contact:

Re: [BETA] Post Control / Approval MOD

Post by nims »

:) Hey its a long long time since I visited this thread.
So how are your twins doing buddy.

Any update on Mass approval or showing full posts awaiting moderation on page to make it bit quick ?
Outsource content writing - Freelance Content Writers
*** Everything related to kids - Kids ***
SEO- search engine optimisation melbourne
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Re: [BETA] Post Control / Approval MOD

Post by sbourdon »

They're doing great; thanks for asking!
But I must admit that they're keeping me quite busy (I also have a 2 year old boy)!

Therefore, due to lack of time, this MOD won't be actively maintained anymore. I will only be able to release bug fixes, if new ones are found. I hope you'll understand...

But if you're looking for Mass Approval, a new MOD has been developped lately which includes that option: http://www.phpbb.com/community/viewtopi ... 5&t=444466 ;)

Cheers!
Post Reply

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