vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Mass Editing of posts question (https://vborg.vbsupport.ru/showthread.php?t=306678)

wraggster 01-06-2014 03:07 PM

Mass Editing of posts question
 
I found a thread over at Vbulletin.com which seems to be something that im looking for basically i want to change all the links in posts on my forum to a new url, replacement variable manager does work mostly but because i grab feeds from our news forums the news forums dont take the replaced variables with it. so on the thread linked above, theres this snippet of code which was used to make a plugin

Code:

if($thread['postuserid'] == '1') {
$find = array(
'________'
);

$replace = array(
''
);

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

could this code be changed so that i can replace on any thread and instead of replacing _____, could i use it to replace www.oldurl.com with www.newurl.com ?

Is this doable?

--------------- Added [DATE]1389025772[/DATE] at [TIME]1389025772[/TIME] ---------------

so would this work

Code:

if($thread['postuserid'] == '1') {
$find = array(
'www.oldurl.com'
);

$replace = array(
'www.newurl.com'
);

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

Still unsure how to make it effect all threads

kh99 01-06-2014 04:42 PM

It sounds to me like you might want to use SQL to permanently change the post text in the database rather than to use a plugin to change it only when it's displayed.

Maybe something like:
Code:

UPDATE post SET pagetext = REPLACE(pagetext, 'www.oldurl.com', 'www.newurl.com') WHERE pagetext LIKE '%www.oldurl.com%'

But doing things like this is a little dangerous. You'd want to back up your database first, or maybe even get someone else to do it if you don't feel comfotable with it.


All times are GMT. The time now is 09:26 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.00949 seconds
  • Memory Usage 1,713KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete