Please remember to click Mark as Installed if you use this modification.
Support questions from members who have not marked this as installed will be considered low priority.
Description: This product allows administrators to cotrol visitor messages for each usergroup with a throttle permissions (required posts/maximum X posts in X time span).
Compatible with: All 3.7.x/3.8.x vBulletin versions.
Features:
Fully Phrased.
Fully Automated.
Fully Supported.
Accurate Processing.
Professionally Coded.
Doing all default vBulletin checks.
Compatible with AJAX & Normal modes.
Can configure Visitor Message throttle Permissions per usergroup:
Minimum posts required before posting visitor message.
Maximum visitor messages allowed to be posted, per X period of time.
X period of time in which the maximum Visitor messages will be limited.
Apply throttle limitations per user profile or over all profiles.
Include own profile or exclude it from throttle limitations.
Installation Procedure:
Upload the "bitfield_ssgti_vm_throttle.xml" file to "/includes/xml/".
Import product's XML file from AdminCP.
Do the following small file edits:
Open the file "includes/class_dm_visitormessage.php" & search in it for the following code:
Code:
OR $this->is_duplicate()
And put the following code after it directly (in the same line):
Code:
OR $this->is_throttled() OR $this->posts_check()
In the same file "includes/class_dm_visitormessage.php" search for the following code:
Code:
function is_duplicate()
And put the following code under this function or above it (the function as a whole):
Code:
/**
* Throttle Stuff
*
* @return boolean whether this is a throttled post or not
*
*/
function is_throttled()
{
if ($this->registry->userinfo['permissions']['ssgti_vm_throttle_hm'] AND $this->registry->userinfo['permissions']['ssgti_vm_throttle_ev'] AND ($this->fetch_field('userid') != $this->fetch_field('postuserid') OR ($this->fetch_field('userid') == $this->fetch_field('postuserid') AND ($this->registry->userinfo['permissions']['ssgti_vm_throttle'] & $this->registry->bf_ugp_ssgti_vm_throttle['ssgti_vm_throttle_own']))))
{
$ssgti_vm_throttle_ev = TIMENOW - ($this->registry->userinfo['permissions']['ssgti_vm_throttle_ev'] * 60);
$query_hook = "";
if ($this->registry->userinfo['permissions']['ssgti_vm_throttle'] & $this->registry->bf_ugp_ssgti_vm_throttle['ssgti_vm_throttle_each'])
{
$query_hook = "AND vm.userid = " . $this->fetch_field('userid');
}
if ($this->fetch_field('dateline') > $ssgti_vm_throttle_ev)
{
// ### THROTTLE CHECK ###
if ($ssgti_vm_throttles = $this->registry->db->query_read_slave("
SELECT vm.userid, user.username
FROM " . TABLE_PREFIX . "visitormessage AS vm
LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid)
WHERE vm.postuserid = " . $this->fetch_field('postuserid') . "
AND vm.dateline > " . $ssgti_vm_throttle_ev . "
$query_hook
"))
{
// print_r($this->registry->db->fetch_array($ssgti_vm_throttles));
if ($this->registry->db->num_rows($ssgti_vm_throttles) >= $this->registry->userinfo['permissions']['ssgti_vm_throttle_hm'])
{
$this->error('ssgti_vm_throttle', $this->registry->userinfo['permissions']['ssgti_vm_throttle_hm'], $this->registry->userinfo['permissions']['ssgti_vm_throttle_ev']);
return true;
}
}
}
return false;
}
}
/**
* Posts Check Stuff
*
* @return boolean whether this user has required posts or not
*
*/
function posts_check()
{
if ($this->registry->userinfo['permissions']['ssgti_vm_throttle_ps'])
{
if ($this->fetch_field('postuserid'))
{
$user = fetch_userinfo($this->fetch_field('postuserid'));
if ($user['posts'] < $this->registry->userinfo['permissions']['ssgti_vm_throttle_ps'])
{
$this->error('ssgti_vm_throttle_posts', $this->registry->userinfo['permissions']['ssgti_vm_throttle_ps'], $user['posts']);
return true;
}
}
return false;
}
}
Save the modified file "includes/class_dm_visitormessage.php" & upload it (Allow Overwrite).