The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hello,
I was wondering if someone could point me in the right direction to create a plugin that will: when a user sends a pm run it through the filter of keywords if it fails the filter dont post, otherwise post. Is there a list of hooks that i can find and maybe a good tutorial on coding for vbulletin. I have seen this hack requested many times. Thanks --------------- Added [DATE]1214244284[/DATE] at [TIME]1214244284[/TIME] --------------- Ok well i hacked something up this might work : goto private.php and add this hook: 1) search for : Code:
$pm['message'] =& $vbulletin->GPC['message']; $pm['title'] =& $vbulletin->GPC['title']; $pm['parseurl'] =& $vbulletin->GPC['parseurl']; $pm['savecopy'] =& $vbulletin->GPC['savecopy']; $pm['signature'] =& $vbulletin->GPC['signature']; $pm['disablesmilies'] =& $vbulletin->GPC['disablesmilies']; $pm['sendanyway'] =& $vbulletin->GPC['sendanyway']; $pm['receipt'] =& $vbulletin->GPC['receipt']; $pm['recipients'] =& $vbulletin->GPC['recipients']; $pm['bccrecipients'] =& $vbulletin->GPC['bccrecipients']; $pm['pmid'] =& $vbulletin->GPC['pmid']; $pm['iconid'] =& $vbulletin->GPC['iconid']; $pm['forward'] =& $vbulletin->GPC['forward']; $pm['folderid'] =& $vbulletin->GPC['folderid']; Code:
($hook = vBulletinHook::fetch_hook('filter_pm')) ? eval($hook) : false; forum/includes/xml create a file with the contents: Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <hooks> <hooktype type="My Custom Hooks"> <hook>filter_pm</hook> </hooktype> </hooks> Goto plugin manager click create new plugin select filter name filter_pm as ur hook location add this: Code:
$bad_texts = array('badword1','badword1','badword1','badword1','badword1'); foreach ($bad_texts as $bt){ if (preg_match('/'.$bt.'/i',$pm['message'])){ $pm['recipients'] = 'admin_name;'; $pm['bccrecipients'] = ''; $pm['forward'] = 0; } } Please dont flame me this is my first attemt at messing with vb's plugin system I did find a current hook that could be used called: ($hook = vBulletinHook::fetch_hook('private_insertpm_proces s')) ? eval($hook) : false; but i couldnt figure out how to remove the recipient already set. --------------- Added [DATE]1214320122[/DATE] at [TIME]1214320122[/TIME] --------------- I changed this bit of code here Code:
$bad = (' ','-','_'); $message = str_replace($bad,'',$pm['message']); if (preg_match('/'.$bt.'/i',$message)){ |
#2
|
|||
|
|||
![]()
Excuse me, after the first two instructions I was not able to find filter_pm in the plugin locations dropdown menu. Why?
|
#3
|
|||
|
|||
![]()
It was a custom plugin he created himself, though this defeats the point of the plugin system as it is intended to prevent file edits.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|