MyBB Community Forums

Full Version: Posts Required To PM and Email
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Seeing a mod that can do this to the PM & Email system would be nice to:

Quote:you can set the minium amount of posts members must have in order to send PM and email other members. You can also set the groups that can bypass this setting.
http://www.mybbcentral.com/showthread.php?tid=1085

And yes...you need to be a Mybb Central subscriber to download it currently. However if you want to make 20 quality posts at WebmasterForums.biz I will email the plugin to you.

PM me if you're interested.
NOPE, if you can't provide them for free then I don't have any use for them.
I just submitted one to the mods thing on here ... guid 91c14b058847532f8b994bb7f68a771e

<?php
/**
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/
function contact_restriction_info()
{
	return array
	(
		"name"	=> 		"Contact Restrictions",
		"description"	=> 	"A plugin that disallows members with under a predefined number of posts to email or pm other members",
		"website" => 		"http://spacesocket.com",
		"author" => 		"J Watkins",
		"authorsite" => 	"http://interviolet.com",
		"version" => 		"0.1",
		"guid" =>		"91c14b058847532f8b994bb7f68a771e"
	);
}
function contact_restriction_activate()
{
	global $db;

	if( $db->insert_query( TABLE_PREFIX . "settinggroups", array( 
		'name' => 'crestrict',
		'title' => 'Contact Restrictions',
		'description' => 'Apply restrictions to inactive members so they cannot contact other members personally',
		'disporder' => 99,
		'isdefault' => 'no'
	) ) )
	{
		if( ( $gid = $db->insert_id( ) ) )
		{
			$settings = array
			(
				array
				(
					'gid' => $gid,
					'name' => 'crenable',
					'title' => 'Enable Contact Restrictions',
					'description' => 'Set to no to disable contact restrictions',
					'optionscode' => 'yesno',
					'value' => 'yes',
					'disporder' => 1
				),
				array
				(
					'gid' => $gid,
					'name' => 'crminimum',
					'title' => 'Minimum Posts',
					'description' => 'This number of posts will be required for members to send private messages or email to other members',
					'optionscode' => 'text',
					'value' => 10,
					'disporder' => 2
				),
				array
				(
					'gid' => $gid,
					'name' => 'crmessage',
					'title' => 'Restricted Message',
					'description' => 'This message will be displayed when the member has less that Minimum Posts',
					'optionscode' => 'textarea',
					'value' => 'Sorry, you are not allowed to contact other members until you have made some more posts',
					'disporder' => 3
				),
				array
				(
					'gid' => $gid,
					'name' => 'crredirect',
					'title' => 'Redirect Location',
					'description' => 'Restricted Message will be displayed while redirecting user, default is redirect to index',
					'optionscode' => 'text',
					'value' => '',
					'disporder' => 4
				)
			);
			foreach( $settings as $setting )
			{
				$db->insert_query( TABLE_PREFIX."settings", $setting );
			}
		}
	}
}
function contact_restriction_deactivate()
{
	global $db;

	if( ( $result = $db->query( "SELECT gid FROM " . TABLE_PREFIX . "settinggroups WHERE name = 'crestrict' LIMIT 1" ) ) )
	{
		if( ( $gid = $db->fetch_field( $result, 'gid' ) ) )
		{
			$db->query( "DELETE FROM " . TABLE_PREFIX . "settinggroups WHERE gid = '{$gid}' LIMIT 1" );
			$db->query( "DELETE FROM " . TABLE_PREFIX . "settings WHERE gid = '{$gid}'" );
		}
	}
}
function contact_restriction()
{
	global $mybb;

	if( ( $mybb->user['uid'] > 0 ) && $mybb->settings['crenable'] == 'yes' )
	{
		if( $mybb->user['postnum'] < $mybb->settings['crminimum'] )
		{
			redirect( $mybb->settings['crredirect'] ? $mybb->settings['crredirect'] : $mybb->settings['bburl'], $mybb->settings['crmessage'], "Contact Restriction" );
		}
	}
}
$plugins->add_hook("private_send_start", "contact_restriction" );
$plugins->add_hook("member_do_emailuser_start", "contact_restriction" );

?>

./inc/plugins/contact_restriction.php

Enable -> Manage Settings -> Contact Restriction

Have fun Smile
Looks nice, I'll test it out. Smile
Anything like this for 1.4 currently?