[MODDB] Minimum posts before PM / Email is allowed

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.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

[MODDB] Minimum posts before PM / Email is allowed

Post by Merlin Sythove » Wed Jan 26, 2005 9:34 am

Here is a mod that someone asked for and I found useful as well.
It will prevent forum members from sending PM or emails to other members until they have made a certain number of posts.

Have fun!

CHANGES 7 june 2007:
azw (Art Zoller Wagner) has added the ACP interface so from now on it is a joined effort! You can switch the limitation on or off, and set the amount of posts a user must have made before being allowed to contact any board member privately via PM or email.

Code: Select all

############################################### 
## MOD Title:   Limit_PM 
## MOD Author: Merlin Sythove  < N/A > (Merlin Sythove) n/a 
## MOD Author: azw < N/A > (Art Zoller Wagner) http://www.DigitalDesign.us 
## MOD Description: Sets a minimum of posts required before 
##              users can send PM or emails to other members. 
##                Admins and mods are excluded, they can send PM and emails immediately. 
##                Also replying to a PM is allowed even if user has not yet posted. 
##              Settings can be changed in Admin Control Panel 
## MOD Version:      1.0.2 
## 
## Installation Level: Moderate 
## Installation Time: 15 minutes 
## Files To Edit: 
##      language/lang_english/lang_main.php (and any other language files you have) 
##      includes/usercp_email.php 
##      privmsg.php 
##      language/lang_english/lang_admin.php (and any other language files you have) 
##      admin/admin_board.php 
##      templates/subSilver/admin/board_config_body.tpl 
## 
## Included Files: N/A 
## 
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
## 
############################################################## 
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
## 1. New files that must be edited in latest version 
##      language/lang_english/lang_admin.php (and any other language files you have) 
##      admin/admin_board.php 
##      templates/subSilver/admin/board_config_body.tpl 
## 
## 2. Many of the variable names have changed since 1.0.1 
## 
## 3. Compatibility / EasyMOD 
##     This MOD is compatible with phpBB 2.0.20 
##     Untested for EasyMOD compatiiblity 
## 
############################################### 
## MOD History: 
## 
## 2006/06/06 - Version 1.0.2 ( Art Zoller Wagner ) 
##   - Added feature to allow admin to enable/disable mod in the Admin Control Panel 
##  - Added feature to allow admin to set minimum number of posts in ACP 
## 
## 2005/01/?? - Version 1.0.1 ( Merlin Sythove ) 
##   - Initial development with fixed minimum number of posts hard-coded 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ SQL ]------------------------------------------- 
# 
# Remember to change the table prefix used on your database 
INSERT INTO `phpbb_config` ( `config_name` , `config_value` ) VALUES ('limit_privmsg_enable', '1'); 
INSERT INTO `phpbb_config` ( `config_name` , `config_value` ) VALUES ('limit_privmsg_number', '25'); 

# 
#-----[ OPEN ]------------------------------------------ 
# 

language/lang_english/lang_admin.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

?> 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

// azw mod minimum posts before pm email 
$lang['Limit_privmsg_title'] = 'Restrict New Members Use of Email & PM'; 
$lang['Limit_privmsg_enable_label'] = 'Enable restriction on email & PM'; 
$lang['Limit_privmsg_enable_explain'] = 'Enable restriction on new members, requiring a minimum number of posts before initiating email or PM contact with other members.'; 
$lang['Limit_privmsg_number_label'] = 'Minimum number of posts'; 
$lang['Limit_privmsg_number_explain'] = 'Enter the number of forum messages a new member must post before being allowed to contact other members by email or PM'; 
// end mod minimum posts before pm email 

# 
#-----[ OPEN ]------------------------------------------ 
# 

language/lang_english/lang_main.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

?> 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# (add a new line after the above partial line) 

// azw mod minimum posts before pm email 
$lang['Limit_privmsg'] = 'You must have written a minimum of %d posts<br />before you can initiate contact with other members<br />by email or private message (PM). Sorry!'; 

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/usercp_email.php 

# 
#-----[ FIND ]------------------------------------------ 
# about line 160 

include($phpbb_root_path . 'includes/page_header.'.$phpEx); 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

      // azw mod minimum posts before pm email 
      if ( $board_config['limit_privmsg_enable'] ) 
      { 
         if ( ( $userdata['user_posts'] < $board_config['limit_privmsg_number'] ) && ( $userdata['user_level'] <= USER ) ) 
         { 
            message_die( GENERAL_MESSAGE, sprintf( $lang['Limit_privmsg'], $board_config['limit_privmsg_number'] ) ); 
         } 
      } 
      // end mod minimum posts before pm email 
    
# 
#-----[ OPEN ]------------------------------------------ 
# 
privmsg.php 

# 
#-----[ FIND ]------------------------------------------ 
# around line 1580 

   if ( !$userdata['user_allow_pm'] && $mode != 'edit' ) 
   { 
      $message = $lang['Cannot_send_privmsg']; 
      message_die(GENERAL_MESSAGE, $message); 
   } 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

   // azw mod minimum posts before pm email 
   if ( $mode == 'post' ) //allow reply regardless 
   { 
      if ( $board_config['limit_privmsg_enable'] ) 
      { 
         if ( ( $userdata['user_posts'] < $board_config['limit_privmsg_number'] ) && ( $userdata['user_level'] <= USER ) ) 
         { 
            message_die( GENERAL_MESSAGE, sprintf( $lang['Limit_privmsg'], $board_config['limit_privmsg_number'] ) ); 
         } 
      } 
   } 
  // end mod minimum posts before pm email 

  
# 
#-----[ OPEN ]------------------------------------------ 
# 

admin/admin_board.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : ""; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
// azw mod minimum posts before pm email 
$limit_privmsg_enable_yes = ( $new['limit_privmsg_enable'] ) ? "checked=\"checked\"" : ""; 
$limit_privmsg_enable_no = ( !$new['limit_privmsg_enable'] ) ? "checked=\"checked\"" : ""; 

# 
#-----[ FIND ]------------------------------------------ 
# 
   "SMTP_NO" => $smtp_no, 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

   // azw mod minimum posts before pm email 
   "L_LIMIT_PRIVMSG_TITLE" => $lang['Limit_privmsg_title'], 
   "L_LIMIT_PRIVMSG_ENABLE_LABEL" => $lang['Limit_privmsg_enable_label'], 
   "L_LIMIT_PRIVMSG_ENABLE_EXPLAIN" => $lang['Limit_privmsg_enable_explain'], 
   "L_LIMIT_PRIVMSG_NUMBER_LABEL" => $lang['Limit_privmsg_number_label'], 
   "L_LIMIT_PRIVMSG_NUMBER_EXPLAIN" => $lang['Limit_privmsg_number_explain'], 
   "LIMIT_PRIVMSG_ENABLE_YES" => $limit_privmsg_enable_yes, 
   "LIMIT_PRIVMSG_ENABLE_NO" => $limit_privmsg_enable_no, 
   "LIMIT_PRIVMSG_NUMBER" => $new['limit_privmsg_number'], 

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/admin/board_config_body.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 
   <tr> 
      <th class="thHead" colspan="2">{L_COOKIE_SETTINGS}</th> 
   </tr> 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
   <tr> 
      <th class="thHead" colspan="2">{L_LIMIT_PRIVMSG_TITLE}</th> 
   </tr> 
   <tr> 
      <td class="row1">{L_LIMIT_PRIVMSG_ENABLE_LABEL}<br /><span class="gensmall">{L_LIMIT_PRIVMSG_ENABLE_EXPLAIN}</span></td> 
      <td class="row2"><input type="radio" name="limit_privmsg_enable" value="1" {LIMIT_PRIVMSG_ENABLE_YES} /> {L_YES}  <input type="radio" name="limit_privmsg_enable" value="0" {LIMIT_PRIVMSG_ENABLE_NO} /> {L_NO}</td> 
   </tr> 
   <tr> 
      <td class="row1">{L_LIMIT_PRIVMSG_NUMBER_LABEL}<br /><span class="gensmall">{L_LIMIT_PRIVMSG_NUMBER_EXPLAIN}</span></td> 
      <td class="row2"><input class="post" type="text" maxlength="255" name="limit_privmsg_number" value="{LIMIT_PRIVMSG_NUMBER}" /></td> 
   </tr> 

# EoM
Last edited by Merlin Sythove on Wed Jun 07, 2006 5:55 am, edited 2 times in total.
Need custom work done? Pimp My Forum!

darakhshan
Registered User
Posts: 794
Joined: Fri Apr 30, 2004 7:18 pm

Post by darakhshan » Wed Jan 26, 2005 4:42 pm

Thanks

Does this prevent receivding PMS or replying pms?

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove » Wed Jan 26, 2005 6:33 pm

It will prevent forum members from sending PM or emails to other members until they have made a certain number of posts.

[/quote]

User avatar
chefsballs
Registered User
Posts: 286
Joined: Sat Jan 14, 2006 12:58 am
Location: UK

Post by chefsballs » Wed May 03, 2006 6:50 pm

Ive installed this...is there a way of enabling this per user? cant via admin cp.

User avatar
ZombieSlayer
Registered User
Posts: 951
Joined: Sun May 02, 2004 3:18 am
Location: California
Contact:

Post by ZombieSlayer » Wed May 03, 2006 8:41 pm

//MOD Limit_PM
$lang['Limit_privmsg'] = 'Sorry, je must have written a minium of %d posts before you can approach other members privately.';


Shouldn't je be you?

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove » Thu May 04, 2006 5:49 am

Yep, it should - my Dutch is showing... :oops:
Need custom work done? Pimp My Forum!

User avatar
ZombieSlayer
Registered User
Posts: 951
Joined: Sun May 02, 2004 3:18 am
Location: California
Contact:

Post by ZombieSlayer » Thu May 04, 2006 7:36 am

It's a cool MOD :) I just don't have the need for it.

User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit » Thu May 04, 2006 10:13 pm

Hello,

Please edit your topic title with a prefix as outlined in MOD Development forum rules, section 3.a. This will allow people to see the development status of your MOD at a glance.

Thank you,
The phpBB MOD Team
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."

azw
Registered User
Posts: 246
Joined: Mon Feb 24, 2003 12:41 am
Contact:

Post by azw » Sat Jun 03, 2006 7:14 pm

Will this mod prevent a new user from replying to a mod that another member or admin has written to them?
Multilingual & bilingual websites for businesses and nonprofits

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove » Sun Jun 04, 2006 11:43 am

azw wrote: Will this mod prevent a new user from replying to a mod that another member or admin has written to them?


No, it only limits NEW pm's a user wants to write. Replying (to anyone), is OK. The purpose is to prevent new people initiating spam, not to limit their interaction. They are still free to approach people by email, including the forum owner or mods who will usually have their email link visible.
Need custom work done? Pimp My Forum!

User avatar
Ramon Fincken
Registered User
Posts: 4835
Joined: Thu Oct 14, 2004 1:04 am
Location: NL, The Netherlands Amsterdam area @GMT +1
Contact:

Post by Ramon Fincken » Sun Jun 04, 2006 2:28 pm

Hi Merlin,

just noticed a small Dutch/English typo over here:

Code: Select all

//MOD Limit_PM
$lang['Limit_privmsg'] = 'Sorry, je must have written a minium of %d posts before you can approach other members privately.'; 
Dutch quality fully managed WordPress hosting - ManagedWPHosting.nl

Before changing a file, some code or installing a MOD >> Make a backup first!

Do you like my mods? paypal me $1 :) forumsoftware[AT}creativepulses[DOT}nl [/size]
PhpBBantispam.com || Instant find your mod here

azw
Registered User
Posts: 246
Joined: Mon Feb 24, 2003 12:41 am
Contact:

Post by azw » Mon Jun 05, 2006 2:11 am

Great, thanks for answering, Merlin.
Multilingual & bilingual websites for businesses and nonprofits

azw
Registered User
Posts: 246
Joined: Mon Feb 24, 2003 12:41 am
Contact:

Post by azw » Tue Jun 06, 2006 3:12 am

I've modded this mod so that an admin can set whether the mod is enabled or disabled and the minimum number of messages.

Would you like to see it, Merlin?
Multilingual & bilingual websites for businesses and nonprofits

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove » Tue Jun 06, 2006 6:47 am

Sure, post it by all means!
Need custom work done? Pimp My Forum!

azw
Registered User
Posts: 246
Joined: Mon Feb 24, 2003 12:41 am
Contact:

Version with Admin Settings in ACP

Post by azw » Tue Jun 06, 2006 8:10 am

Merlin, I've formatted this so it meets the Mod specs. Please note that I changed some of the variable names to make it easier to remember what they do because I had to add a number of new variables.

Please let me know if I should change any of the info in this. I'll be happy to edit it. In particular, you'll want to note that I changed it to the GNU license. That's pretty standard, but you may want to change it back.

I haven't tested it yet with EasyMod.

Code: Select all

###############################################
## MOD Title:   Limit_PM
## MOD Author: Merlin Sythove  < N/A > (Merlin Sythove) n/a
## MOD Author: azw < N/A > (Art Zoller Wagner) http://www.DigitalDesign.us
## MOD Description: Sets a minimum of posts required before
##				  users can send PM or emails to other members.
##                Admins and mods are excluded, they can send PM and emails immediately.
##                Also replying to a PM is allowed even if user has not yet posted.
##				  Settings can be changed in Admin Control Panel
## MOD Version:		1.0.2
##
## Installation Level: Moderate
## Installation Time: 15 minutes
## Files To Edit:
##      language/lang_english/lang_main.php (and any other language files you have)
##      includes/usercp_email.php
##      privmsg.php
##		language/lang_english/lang_admin.php (and any other language files you have)
##		admin/admin_board.php
##		templates/subSilver/admin/board_config_body.tpl
##
## Included Files: N/A
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## 1. New files that must be edited in latest version
##		language/lang_english/lang_admin.php (and any other language files you have)
##		admin/admin_board.php
##		templates/subSilver/admin/board_config_body.tpl
##
## 2. Many of the variable names have changed since 1.0.1
##
## 3. Compatibility / EasyMOD
##     This MOD is compatible with phpBB 2.0.20
##     Untested for EasyMOD compatiiblity
##
###############################################
## MOD History:
##
## 2006/06/06 - Version 1.0.2 ( Art Zoller Wagner )
##	- Added feature to allow admin to enable/disable mod in the Admin Control Panel
##  - Added feature to allow admin to set minimum number of posts in ACP
##
## 2005/01/?? - Version 1.0.1 ( Merlin Sythove )
##	- Initial development with fixed minimum number of posts hard-coded
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]-------------------------------------------
#
# Remember to change the table prefix used on your database
INSERT INTO `phpbb_config` ( `config_name` , `config_value` ) VALUES ('limit_privmsg_enable', '1');
INSERT INTO `phpbb_config` ( `config_name` , `config_value` ) VALUES ('limit_privmsg_number', '25');

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

// azw mod minimum posts before pm email
$lang['Limit_privmsg_title'] = 'Restrict New Members Use of Email & PM';
$lang['Limit_privmsg_enable_label'] = 'Enable restriction on email & PM';
$lang['Limit_privmsg_enable_explain'] = 'Enable restriction on new members, requiring a minimum number of posts before initiating email or PM contact with other members.';
$lang['Limit_privmsg_number_label'] = 'Minimum number of posts';
$lang['Limit_privmsg_number_explain'] = 'Enter the number of forum messages a new member must post before being allowed to contact other members by email or PM';
// end mod minimum posts before pm email

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
# (add a new line after the above partial line)

// azw mod minimum posts before pm email
$lang['Limit_privmsg'] = 'You must have written a minimum of %d posts<br />before you can initiate contact with other members<br />by email or private message (PM). Sorry!';

#
#-----[ OPEN ]------------------------------------------
#

includes/usercp_email.php

#
#-----[ FIND ]------------------------------------------
# about line 160

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

#
#-----[ BEFORE, ADD ]------------------------------------------
#

		// azw mod minimum posts before pm email
		if ( $board_config['limit_privmsg_enable'] )
		{
			if ( ( $userdata['user_posts'] < $board_config['limit_privmsg_number'] ) && ( $userdata['user_level'] <= USER ) )
			{
				message_die( GENERAL_MESSAGE, sprintf( $lang['Limit_privmsg'], $board_config['limit_privmsg_number'] ) );
			}
		}
		// end mod minimum posts before pm email
   
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php

#
#-----[ FIND ]------------------------------------------
# around line 1580

   if ( !$userdata['user_allow_pm'] && $mode != 'edit' )
   {
      $message = $lang['Cannot_send_privmsg'];
      message_die(GENERAL_MESSAGE, $message);
   }

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// azw mod minimum posts before pm email
	if ( $mode == 'post' ) //allow reply regardless
	{
		if ( $board_config['limit_privmsg_enable'] )
		{
			if ( ( $userdata['user_posts'] < $board_config['limit_privmsg_number'] ) && ( $userdata['user_level'] <= USER ) )
			{
				message_die( GENERAL_MESSAGE, sprintf( $lang['Limit_privmsg'], $board_config['limit_privmsg_number'] ) );
			}
		}
	}
  // end mod minimum posts before pm email

  
#
#-----[ OPEN ]------------------------------------------
#

admin/admin_board.php

# 
#-----[ FIND ]------------------------------------------ 
#
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// azw mod minimum posts before pm email
$limit_privmsg_enable_yes = ( $new['limit_privmsg_enable'] ) ? "checked=\"checked\"" : "";
$limit_privmsg_enable_no = ( !$new['limit_privmsg_enable'] ) ? "checked=\"checked\"" : "";

# 
#-----[ FIND ]------------------------------------------ 
#
	"SMTP_NO" => $smtp_no,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

	// azw mod minimum posts before pm email
	"L_LIMIT_PRIVMSG_TITLE" => $lang['Limit_privmsg_title'],
	"L_LIMIT_PRIVMSG_ENABLE_LABEL" => $lang['Limit_privmsg_enable_label'],
	"L_LIMIT_PRIVMSG_ENABLE_EXPLAIN" => $lang['Limit_privmsg_enable_explain'],
	"L_LIMIT_PRIVMSG_NUMBER_LABEL" => $lang['Limit_privmsg_number_label'],
	"L_LIMIT_PRIVMSG_NUMBER_EXPLAIN" => $lang['Limit_privmsg_number_explain'],
	"LIMIT_PRIVMSG_ENABLE_YES" => $limit_privmsg_enable_yes,
	"LIMIT_PRIVMSG_ENABLE_NO" => $limit_privmsg_enable_no,
	"LIMIT_PRIVMSG_NUMBER" => $new['limit_privmsg_number'],

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/admin/board_config_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
	<tr>
		<th class="thHead" colspan="2">{L_COOKIE_SETTINGS}</th>
	</tr>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
	<tr>
		<th class="thHead" colspan="2">{L_LIMIT_PRIVMSG_TITLE}</th>
	</tr>
	<tr>
		<td class="row1">{L_LIMIT_PRIVMSG_ENABLE_LABEL}<br /><span class="gensmall">{L_LIMIT_PRIVMSG_ENABLE_EXPLAIN}</span></td>
		<td class="row2"><input type="radio" name="limit_privmsg_enable" value="1" {LIMIT_PRIVMSG_ENABLE_YES} /> {L_YES}  <input type="radio" name="limit_privmsg_enable" value="0" {LIMIT_PRIVMSG_ENABLE_NO} /> {L_NO}</td>
	</tr>
	<tr>
		<td class="row1">{L_LIMIT_PRIVMSG_NUMBER_LABEL}<br /><span class="gensmall">{L_LIMIT_PRIVMSG_NUMBER_EXPLAIN}</span></td>
		<td class="row2"><input class="post" type="text" maxlength="255" name="limit_privmsg_number" value="{LIMIT_PRIVMSG_NUMBER}" /></td>
	</tr>

# EoM
Last edited by azw on Wed Jun 07, 2006 3:51 am, edited 1 time in total.
Multilingual & bilingual websites for businesses and nonprofits

Locked

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