• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

MySQL Request - changing BBCODE in Messages

kankan

Active member
#1
Hello,

I have just migrated my PunBB messages to a fresh Xenforo set up.
I got some tweaked BBCode in my PunBB forum like : [imgz]picture.jp[/imgz] (to make a thumbnail of the picture) and [img align=C] (to center the image)
Of course those BBcodes are not understood by Xenforo and asking myself if i could run a MySQL request to parse the message database and automatically change those BBCodes from [imgz] to

As i am not very involved into MySQL, how do i have to write the command ?

Kindest regards,

Nicolas
 

cclaerhout

Well-known member
#2
Hello,

I have just migrated my PunBB messages to a fresh Xenforo set up.
I got some tweaked BBCode in my PunBB forum like : [imgz]picture.jp[/imgz] (to make a thumbnail of the picture) and [img align=C] (to center the image)
Of course those BBcodes are not understood by Xenforo and asking myself if i could run a MySQL request to parse the message database and automatically change those BBCodes from [imgz] to

As i am not very involved into MySQL, how do i have to write the command ?

Kindest regards,

Nicolas
Use this addon to recreate your bbcodes. And if your bbcode is using an url to parse an image for example, also use this addon.
You might need this addon too to perform search & replace.
 

kankan

Active member
#5
Hi Jake
Thank you for your answer
Just tested this addon
Met the following pb :

I have filled the info as followed :
Quick Find: [imgz

Regular Expression: [imgz]

Replacement String:
Code:
[img]
But the results in the post were like this :
Code:
[[img]]
Anything i did wrong ?
 

cclaerhout

Well-known member
#8
Use this regex for imgz bbcodes (the imgz opening tag can't contain any options)
Code:
#\[imgz\](.+?)\[/imgz\]#ui
=> [] are escaped

In replacement string you can use \1 for your bbcode content; for example:
Code:
[newbbcode]\1[/newbbcode]
=> [] are not escaped
 

kankan

Active member
#13
Thank you Cedric :

Getting this message :
Server Error

preg_match_all() [function.preg-match-all]: Delimiter must not be alphanumeric or backslash
  1. XenForo_Application::handlePhpError()
  2. preg_match_all() in PostReplace/ControllerAdmin/PostReplace.php at line 26
  3. PostReplace_ControllerAdmin_PostReplace->actionReplace() in XenForo/FrontController.php at line 310
  4. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 13
 

kankan

Active member
#18
What would be the query to change :
Code:
[video][media=youtube]m6XEB9Aj9KA[/media] into Xen ?
I tried :
Code:
#\[video\]http:.+youtube.+v=(\w+)\1\].+\[/video\]#siU
then in replacement :
Code:
[media=youtube]\2[/media]
But nothing

Thank you
 

cclaerhout

Well-known member
#19
What would be the query to change :
Code:
[video][media=youtube]m6XEB9Aj9KA[/media] into Xen ?
I tried :
Code:
#\[video\]http:.+youtube.+v=(\w+)\1\].+\[/video\]#siU
then in replacement :
Code:
[media=youtube]\2[/media]
But nothing

Thank you
Are you sure about this pattern:
Code:
[video][media=youtube]m6XEB9Aj9KA[/media] into Xen ?
I think you mixed up both bbcodes
What is the source?
 

kankan

Active member
#20
yes sorry, mixed up during the edition of my post
please read:
Code:
[video]http://www.youtube.com/watch?v=m6XEB9Aj9KA&feature=related[/video]