vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Mod that will replace certain word with another (https://vborg.vbsupport.ru/showthread.php?t=258916)

Sean S 02-15-2011 02:33 PM

Mod that will replace certain word with another
 
Hi there,

I remember seeing a mod for vB4 here before which allowed certain words to be replaced by another. For example, in the setting you could have

red;orange

and the mod would replace posts containing the word red with orange. I can't seem to find it here now, anyone can help or know the name of the mod? :(

thank you.

Lynne 02-15-2011 03:32 PM

You can just use Replacement Variables. Or, write a plugin with a $find array and $replace array and just do a str_replace where you want it.

Sean S 02-25-2011 04:58 PM

thanks Lynne, that seems to be the easier option :)

prophetmuhammad 11-21-2011 01:13 PM

is this how you do this?

$find = array(
'word'
);

$replace = array(
'word1'
);

$this->post['message'] = str_replace($find, $replace, $this->post['message']);

Lynne 11-21-2011 05:55 PM

Yes, that is how you should do it.

prophetmuhammad 11-22-2011 03:10 AM

tried it, doesn't work. i run vb 4.1.7

kh99 11-22-2011 03:29 AM

Which hook location did you use?

prophetmuhammad 11-22-2011 03:40 AM

Quote:

Originally Posted by kh99 (Post 2270620)
Which hook location did you use?


i'm not really sure which one to use! can't find anything that refers to the post :\

right now it's set to the default that came with the script... postbit_display_complete

Lynne 11-22-2011 06:31 PM

That code worked just fine for me using the postbit_display_complete hook location on my 4.1.8 test site.

prophetmuhammad 11-22-2011 06:52 PM

ok i figured it out. turns out the script doesn't work for phrases i guess


All times are GMT. The time now is 09:00 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.01138 seconds
  • Memory Usage 1,724KB
  • 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_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