Resource icon

Post Content Find / Replace 1.0.0

No permission to download
... but I can't get it to do anything on that youtube one.
If you're still having problems with those media tags, I ended up doing two different runs. For the life of me I couldn't figure out how to combine the two of them to handle some of the old media tags having extra params at the end of the YouTube ID so a two-pass approach was easier & faster than me playing around with regex further.
Code:
Quick Find: [media]
Regular Expression: #\[media]http:.+youtube.+v=([a-zA-Z0-9_\-]+)&.+\[/media]#siU
Replacement String: [media=youtube]$1[/media]

That took of the ones that had additional parameters. After that I did a second run (code below) to handle the bulk of them that did not have additional paramters.

Code:
Quick Find: [media]
Regular Expression: #\[media]http:.+youtube.+v=([a-zA-Z0-9_\-]+)\[/media]#siU
Replacement String: [media=youtube]$1[/media]
 
If you're still having problems with those media tags, I ended up doing two different runs. For the life of me I couldn't figure out how to combine the two of them to handle some of the old media tags having extra params at the end of the YouTube ID so a two-pass approach was easier & faster than me playing around with regex further.
Code:
Quick Find: [media]
Regular Expression: #\[media]http:.+youtube.+v=([a-zA-Z0-9_\-]+)&.+\[/media]#siU
Replacement String: [media=youtube]$1[/media]

That took of the ones that had additional parameters. After that I did a second run (code below) to handle the bulk of them that did not have additional paramters.

Code:
Quick Find: [media]
Regular Expression: #\[media]http:.+youtube.+v=([a-zA-Z0-9_\-]+)\[/media]#siU
Replacement String: [media=youtube]$1[/media]

You're a life saver! I definitely still needed this, thanks so much!
 
If I previously had a PHPBB forum that used

[youtube:199yy4hy]Gg5SwyTvAHw[/youtube:199yy4hy]

to embed youtube videos with the actual video code being [youtube]IN HERE[/youtube] and the [youtube:BITS HERE][/youtube:AND HERE] being unimportant and useless. Could I use this plugin to somehow convert those to the xenforo formatted youtube embed? I know nearly nothing about Regular Expressions and would really appreciate some help.
 
I too converted from phpBB and had to run hundreds of regex and SQL queries to fix all the broken BB Code, due to the random hex strings you've mentioned above.

Try this for YouTube.

Take a backup first though!

Quick Find
Code:
[youtube

Regular Expression
Code:
#\[(youtube):([a-z0-9_]+)\](.*)\[/\1:\2]#siU

Replacement String
Code:
[\1]\3[/\1]

Don't forget that you will also need to convert the tags from youtube to media=youtube.
You can do that with standard queries.
Code:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
 
The instructions don't cover the four folders that come with the xml file. Are they uploaded too? Where?
Put the "PostReplace" folder into your /library folder and the import the XML as an addon. You should then see a new option under your Tools menu.
 
OK, bear with me. My code abilities are minimal to none.

I want an expression that will take something like this:

Code:
[media=youtube]0IzCyp-dwbs"[/media]

And just remove the quote at the end.

Also, one that will remove any code that has a "$" plus subsequent content before the closing expression.

Also, does this thing give you a status bar or something to show it really worked? When I tried a couple of these search/replaces, all it did was show activity and and stop.
 
And yet another:

Code:
<object width="400" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=169308&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=169308&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="250"></embed></object><br /><a href="http://vimeo.com/169308">Magnetosphere revisited (audio by Tosca)</a> from <a href="http://vimeo.com/flight404">flight404</a> on <a href="http://vimeo.com">Vimeo</a>.

Hopeless?
 
And just remove the quote at the end.
If all of those are identical, the easiest way is to do a simple SQL query.
Code:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');

So in your case it would be:
Rich (BB code):
UPDATE xf_post SET message = REPLACE(message,'"[/media]','[/media]');
 
OK, so we have the two youtube conversions.

We have the long vimeo.com conversion string.

And we have several similar to this:

Code:
[video]http://video.google.ca/videoplay?docid=-7618668614373448584&ei=EvqkS86eMpaoqwKbwIymDA&q=mac+tonnies+cryptoterrestrials&hl=en#[/video]

So I need four conversion routines so far. I've done some manual work in our forums, but this would sure save us lots and lots of work if someone can help me make it happen.
 
If anyone tries smf2 => vbb 3.8.7 => xenforo 1.1

and your quotes are messed up and looking like this
Code:
[quote author=H_Ercule_S link=topic=4436.msg19735#msg19735 date=1323150879]
this is what i did to 99% fix it:

Quick:
Code:
[quote

Regex:
Code:
#\[(quote) (author)=([A-Za-z0-9_]+) (link)=(topic)=([a-z0-9_-]+).(msg)([a-z0-9_-]+)\#(msg)([a-z0-9_-]+) (date)=([a-z0-9_-]+)\]#

Replace:
Code:
[quote="\3, post: \8"]

might not be beautiful but it works,
only quotes which are still messed up are the ones made by deleted users (they have no post-id) but i hope you dont have that many deleted users :D
 
I had [m]thefullvideolink[/m] from jaxel's 8wayrun media library back on vbulletin 4.

How do I do a post content find/replace to get rid of the [m] [/m] tag but keep the full link in between?

I know that once the [m] tags are gone, the full link will be automatically embedded.
 
Code:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');

So in your case:

Code:
UPDATE xf_post SET message = REPLACE(message,'[m]','');
UPDATE xf_post SET message = REPLACE(message,'[/m]','');


You could also change the tags to the standard youtube tags, or whatever works.

Backup first.
 
Code:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');

So in your case:

Code:
UPDATE xf_post SET message = REPLACE(message,'[m]','');
UPDATE xf_post SET message = REPLACE(message,'[/m]','');


You could also change the tags to the standard youtube tags, or whatever works.

Backup first.
Thanks but I can't do that because vb4 8wayrun [m] media tags automatically embed multiple video sources.

For instance [m]fullyoutubelink[/m], [m]fulldailymotionlink[/m], [m]fullvimeolink[/m]

Gonna try your code in phpadmin thank you!
 
When I used vBulletin 3.x, YouTube videos were initially embedded using the [yt] [/yt] tags and only including the ID of the video after "v=" so that you might see something like [yt]gD_5Tp7W-Gg[/yt]

Can the Find/Replace tool still be utilized in this case? I am not sure how best to approach this issue: Should I be replacing the [yt] with http://youtube.com/watch?v= I am apparently assuming that if the rest of the URL were present, auto-embedding for the videos would be triggered when the relevant pages are next loaded.

Can that even be done? I am not familiar with regular expressions.
 
A standard XenForo YouTube embed takes this form: [MEDIA=youtube]oHg5SJYRHA0[/MEDIA]

Therefore you can use simple SQL queries as I posted above to replace yt with MEDIA=youtube and /yt with /MEDIA.
 
From your advice, I figured out to run this:

Code:
UPDATE xf_post SET message = REPLACE(message,'[yt]','[MEDIA=youtube]');
UPDATE xf_post SET message = REPLACE(message,'[/yt]','[/MEDIA]');
Now they work! And now I get simple replacement queries.

Thank you again, Brogan.
 
I'm having trouble getting my vB4 links converted, can't seem to figure the expressions out. :mad:

Here are the default links.

Code:
[video=vimeo;20759609]http://vimeo.com/20759609[/video]
Code:
[video=youtube;aNsucu92jwk]http://www.youtube.com/watch?v=aNsucu92jwk[/video]
 
Top Bottom