Resource icon

Post Content Find / Replace 1.0.0

No permission to download
Same.

SQL:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');

1.) is this case sensitive? I have to replace a case sensitive content. thank you!

2.) Can you modify the sql query to find and replace on posts older than 1month only?
 
I would like to replace: (post: variable)
Code:
[quote="[USER=1]@zzz[/USER], post: 123"]

with:
Code:
[QUOTE="zzz, post: 123, member: 1"]

Does anyone have an idea how?

* * * Edit: Problem solved * * *

Regular expression: #\[quote="\[USER=([0-9]+)]@zzz\[/USER], post: ([0-9]+)"]#siU

Replacement string: [QUOTE="zzz, post: \2, member: 111"]
 
Last edited:
I'm dealing with a photography forum that has been around a number of years with its origins dating back to several smaller forums that were merged together. Over the years there was vBulletin, XF, and possibly other stuff in the mix. At some point in its history it looks like linked images were converted to being inline local attached images (likely through one of the add-ons like Convert Image from AndyB). Unfortunately either the addon or the merging of forums or the migration of vB to XF or something else has left some of the posts displaying raw HTML.

Live Sample: https://cameraderie.org/threads/the-inevitable-cat-thread.40217/#post-274921

Attached is an image of how it looks for anybody who doesn't want to click-through to the example.

Here's a snippy of the sample post showing the ATTACH BB Code in the middle of the original raw HTML link.
Code:
Romeo:
<a href="http://www.flickr.com/photos/franxblank/8403731690/" title="romeo1 di franxblank, su Flickr">[ATTACH type="full"]154084[/ATTACH]"500" height="376" alt="romeo1"></a>
and Sutica:
<a href="http://www.flickr.com/photos/franxblank/8419996889/" title="I taw I taw a putty tat.. di franxblank, su Flickr">[ATTACH type="full"]154085[/ATTACH]"500" height="375" alt="I taw I taw a putty tat.."></a>

With all of that in mind then, would I be able to clean up something like <a href="http://www.flickr.com/photos/franxblank/8403731690/" title="romeo1 di franxblank, su Flickr">[ATTACH type="full"]154084[/ATTACH]"500" height="376" alt="romeo1"></a>
... to be just [ATTACH type="full"]154084[/ATTACH]?
 

Attachments

  • 1555691132653.webp
    1555691132653.webp
    30.3 KB · Views: 2
@Kier, would it be possible to get this addon updated with an "Only first post / original post"-filter, which would exclude any post that is not the first post in a thread?

I was looking at the addon source, but since my knowledge of PHP is not the best, and I don't know the SQL schema for Xenforo posts/threads, I don't dare to extend it myself :D
 
Rather than ping the addon author, you should link to the addon if anything.
Code:
doublepost
it looks like it uses timestamps so
Code:
#\[(doublepost)=[0-9]{10}]\[/\1]#siu
Thank you. It works if doublepost use one timestamp.
But in our forum, i see like these tags (two timestamp i though)

[doublepost=1550477844,1550401979][/doublepost]

So, how can i delete them instead of your code.
 
You are welcome.

This will match an unlimited amount of timestamps.

Code:
#\[(doublepost)=(?:(?:[0-9]{10})(?:,)?)*]\[/\1]#siu
Thank you again.

And can you please help me about that required regex for me also?

I moved the our board from subfolder to subdomain; so i need change all url's which posted on forum.

Old URL's: https://www.domain.com/forum/xxxx/
New URL's: https://forum.domain.com/xxx/

P.S: removed old extra forum directory and moved to root of the subdomain.
 
Anyone an indea how to convert this? (/ to _)

Code:
[MEDIA=dumpert]7713821/76bbe55a[/MEDIA]
to
[MEDIA=dumpert]7713821_76bbe55a[/MEDIA]
 
Last edited:
hello i have to replace [MENTION= with [USER=

Quick Find: [MENTION=
Regular Expression: #/[MENTION= .....i don't know hot to close the expression
Replacement String: [USER=

can you give me suggestion please?
thanks.
 
hello i have to replace [MENTION= with [USER=

Quick Find: [MENTION=
Regular Expression: #/[MENTION= .....i don't know hot to close the expression
Replacement String: [USER=

can you give me suggestion please?
thanks.
[/QUOTE]

i find it: #\[MENTION=#siU
have worked very well.
 
Hi guys,
Will this work if I wanted to change the name of quotes after a username change? If so, can someone give me an example please providing it will not cause any issues

Thanks in advance!
 
i use sql command for find and replace. but only if the username is an obscure keyword. not sure it would be possible to safety do a find and replace if the username is a common word 🤔
 
It's safe enough as long as the match string isn't ambiguous.

You would use this, for example: [QUOTE="Brogan which would only match quoted content by me.

As always, back up the database/table before making any changes.
 
It's safe enough as long as the match string isn't ambiguous.

You would use this, for example: [QUOTE="Brogan which would only match quoted content by me.

As always, back up the database/table before making any changes.
So would it be like this?

Quick find: Username
Regular expressions: [QUOTE="Username
Replacement string: Username

I'm going to be using the 2.1 version.
 
I was responding to @OperaManiac regarding the simple SQL query option.

This add-on requires using regex - there are many examples in the thread how to create the find and replace strings.
 
Back
Top Bottom