PDA

View Full Version : Administrative and Maintenance Tools - SSGTI - Visitor Message Throttle


Omranic
07-23-2009, 10:00 PM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!.............. Sponsored by: PHP KingDom (www.phpkd.net) ..............!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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.

Note: This product has been requested as a paid product, It has been completed & delivered few months ago. It's licensed under Creative Commons - Attribution-Noncommercial-Share Alike 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/), I hope this product will be useful for all of you.


Name: Visitor Message Throttle - Version: 3.7.100

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:
OR $this->is_duplicate()
And put the following code after it directly (in the same line):
OR $this->is_throttled() OR $this->posts_check()






In the same file "includes/class_dm_visitormessage.php" search for the following code:
function is_duplicate()

And put the following code under this function or above it (the function as a whole):
/**
* 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).

Done :).



Control:

vBulletin AdminCP -> Usergroups -> Usergroup Manager -> Visitor Message Permissions -> Throttle ... Perms



License:

Creative Commons - Attribution-Noncommercial-Share Alike 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)



Help with:

Suggestions to develop this product.
Contributing any updates, upgrades and/or any new features.
Translations to benefit more users (translation credits goes to their owners).
Spreading this product. Yes, you're free to re-distribute this product as it is.



Known Isues:

Nothing till now.



History:

v3.7.100 24/07/2009 10:00 PM UTC: First initial public release.



Screen Shots:

Available down there.



Notes:

English version only supported & supplied here, for any other localized release please contact me.



Technical Notes:


New Plugins: 0
New Phrases: 7
New Templates: 0
Template changes: 0
New Files: 1
File Changes: 2
New vBulletin Settings: 0
New Usergroup Permissions: 5
New Moderator Permissions: 0
New Administrator Permissions: 0
New Forum Options: 0
New DB Tables: 0
DB Alterations: 4
New Cron Jops: 0
--------------------------------
Installation Level: Easy
Installation Time: 30~40 seconds




Donation?:

No, sorry. I appreciate your kindness. But if you need to help/support, then you can ask me for custom work. I'm ready for any custom work :).



Recent Products:

SSGTI - Auto Ban Under Age Users (https://vborg.vbsupport.ru/misc.php?do=producthelp&pid=ssgti_banunderage)
SSGTI - Prevent Duplicate Posts (https://vborg.vbsupport.ru/misc.php?do=producthelp&pid=ssgti_prevent_duplposts)
SSGTI - Subscription Certain Payment APIs (https://vborg.vbsupport.ru/misc.php?do=producthelp&pid=paidsubcertainapi)
SSGTI - Paypal 2 Payment Module [ API ] (https://vborg.vbsupport.ru/misc.php?do=producthelp&pid=api_paypal2)
SSGTI - Hide AdminCP vB News table if all news are dismissed (https://vborg.vbsupport.ru/misc.php?do=producthelp&pid=hidevbnewswad)

newmasalaboard
08-05-2009, 04:46 PM
Thanks a million ...

Installed!