View Full Version : Prevent one member from writing a specific word
hazem_aliraqi
05-25-2015, 04:02 PM
hi
i want to ban someone of user to write a word
if there is any plugin to do this ?
MarkFL
05-25-2015, 04:52 PM
You can create 2 plugins, at the following hook locations:
editpost_update_start
newreply_post_start
And use the following Plugin PHP Code:
if ($vbulletin->userinfo['userid'] == XX)
{
$vbulletin->GPC['message'] = str_ireplace("banned_text", "", $vbulletin->GPC['message']);
}
Replace XX with the userid of the user for whom the word is banned and replace banned_text with the actual banned word. The banned word will just be removed from the post content (regardless of case) for that user when creating new posts and editing existing posts.
hazem_aliraqi
05-26-2015, 06:14 AM
thank u mark :)
--------------- Added 1432629398 at 1432629398 ---------------
not work for arabic word ?
ForceHSS
05-26-2015, 09:27 AM
It should work for the word you put in there does not matter if its arabic or english
hazem_aliraqi
05-26-2015, 09:59 AM
It should work for the word you put in there does not matter if its arabic or english
not work i try it
if ($vbulletin->userinfo['userid'] == 1)
{
$vbulletin->GPC['message'] = str_ireplace("حازم", "", $vbulletin->GPC['message']);
}
ForceHSS
05-26-2015, 10:34 AM
You made them plugins the both of them. What vb version? and did you use notepad++ to edit it or just copy and paste from here
hazem_aliraqi
05-26-2015, 10:40 AM
You made them plugins the both of them. What vb version?
no only in newreply_post_start
and it work with English word
vb 4.2.3
ForceHSS
05-26-2015, 10:43 AM
Have the same version will test
ok tested does not block حازم
There's an encoding issue, so that the str_ireplace() doesn't match the word. I can't figure out how to encode your word so that it will match, but I have a different suggestion: use the existing censoring and add the word only for the given user by using a plugin on hook global_bootstrap_init_start and code like this:
if ($vbulletin->userinfo['userid'] == XX)
{
$vbulletin->options['censorwords'] .= "\nحازم";
}
This is different because it will replace the word with a lot of '*' characters instead of deleting it, and also it will work everywhere the censor works instead of just for posts (which may or may not be an advantage for you).
If you'd rather not using the censoring mechanism, there are probably other hooks that can be used with MarkFL's code which will do the str_ireplace after the message text has been decoded.
MarkFL
05-26-2015, 11:13 AM
Have the same version will test
ok tested does not block حازم
That's odd...it blocks that text for me (on my vB 4.2.1 local dev site)...:confused:
That's odd...it blocks that text for me (on my vB 4.2.1 local dev site)...:confused:
Hmm...it could have something to do with what encoding the user's OS or the forum it set for. I don't really understand the whole encoding thing very well, but when I tried your code I found that the message text had the arabic word '%u' encoded so that it wouldn't match the literal string in the code. Maybe if you have a forum set to use UTF-8 that wouldn't happen, or something like that.
hazem_aliraqi
05-26-2015, 11:20 AM
There's an encoding issue, so that the str_ireplace() doesn't match the word. I can't figure out how to encode your word so that it will match, but I have a different suggestion: use the existing censoring and add the word only for the given user by using a plugin on hook global_bootstrap_init_start and code like this:
if ($vbulletin->userinfo['userid'] == XX)
{
$vbulletin->options['censorwords'] .= "\nحازم";
}
This is different because it will replace the word with a lot of '*' characters instead of deleting it, and also it will work everywhere the censor works instead of just for posts (which may or may not be an advantage for you).
If you'd rather not using the censoring mechanism, there are probably other hooks that can be used with MarkFL's code which will do the str_ireplace after the message text has been decoded.
thank you kh99 for your help
its work fine now :)
thanks for Force and mark too ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.