vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Prevent one member from writing a specific word (https://vborg.vbsupport.ru/showthread.php?t=318812)

hazem_aliraqi 05-25-2015 04:02 PM

Prevent one member from writing a specific word
 
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:

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 [DATE]1432629398[/DATE] at [TIME]1432629398[/TIME] ---------------

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

Quote:

Originally Posted by ForceHSS (Post 2546439)
It should work for the word you put in there does not matter if its arabic or english


not work i try it



HTML Code:

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

Quote:

Originally Posted by ForceHSS (Post 2546442)
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 حازم

kh99 05-26-2015 11:10 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:
PHP Code:

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

Quote:

Originally Posted by ForceHSS (Post 2546444)
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:


All times are GMT. The time now is 02:23 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01089 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete