BBCode tags stored in phpbb_posts?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
User avatar
The Senator
Registered User
Posts: 151
Joined: Wed Jan 09, 2008 5:50 am

BBCode tags stored in phpbb_posts?

Post by The Senator » Mon Mar 18, 2013 3:38 am

Quick question: are BBCode tags stored along with the rest of the post text in phpbb_posts, or are they handled in some special way? The reason I ask is that I need to do a global search and replace of an old BBCode tag with a new BBCode tag to take its place, and I need to know if something like the following will work in phpMyAdmin:

Code: Select all

UPDATE phpbb_posts
SET post_text = REPLACE(post_text, '[oldtag]', '[newtag]') ; 
and

Code: Select all

UPDATE phpbb_posts
SET post_text = REPLACE(post_text, '[/oldtag]', '[/newtag]') ; 
thanks,
andy

User avatar
HGN
Former Team Member
Posts: 4706
Joined: Wed Dec 03, 2008 1:53 pm
Location: The Netherlands
Name: Alfred
Contact:

Re: BBCode tags stored in phpbb_posts?

Post by HGN » Mon Mar 18, 2013 9:03 pm

No that will not work.
Per post a bbcode_uid is added to the BBCode, e.g. for bold it will look like [b:3pkg1i5c] [/b:3pkg1i5c]. The bbcode_uid is stored in the same record in the posts table.

User avatar
The Senator
Registered User
Posts: 151
Joined: Wed Jan 09, 2008 5:50 am

Re: BBCode tags stored in phpbb_posts?

Post by The Senator » Mon Mar 18, 2013 11:35 pm

HGN wrote:No that will not work.
Per post a bbcode_uid is added to the BBCode, e.g. for bold it will look like [b:3pkg1i5c] [/b:3pkg1i5c]. The bbcode_uid is stored in the same record in the posts table.
"Per post" seems to imply the uid is unique to each post, and therefore there's no way to do a global search-and-replace like I want. Or is there some other way to do what I'm trying to do?

thanks

User avatar
DionDesigns
Registered User
Posts: 515
Joined: Sun Feb 26, 2012 11:22 pm
Location: Uncertain due to momentum.
Contact:

Re: BBCode tags stored in phpbb_posts?

Post by DionDesigns » Tue Mar 19, 2013 12:57 am

If the BBcode you want to replace is of the form [oldtag][/oldtag] and not something like [oldtag=DATA][/oldtag], then this should work:

Code: Select all

UPDATE phpbb_posts SET post_text = REPLACE(post_text, '[oldtag:', '[newtag:');
UPDATE phpbb_posts SET post_text = REPLACE(post_text, '[/oldtag:', '[/newtag:');
Make a backup of your _posts table before executing these SQL commands...just in case.

User avatar
The Senator
Registered User
Posts: 151
Joined: Wed Jan 09, 2008 5:50 am

Re: BBCode tags stored in phpbb_posts?

Post by The Senator » Tue Mar 19, 2013 10:29 pm

DionDesigns wrote:If the BBcode you want to replace is of the form [oldtag][/oldtag] and not something like [oldtag=DATA][/oldtag], then this should work:

Code: Select all

UPDATE phpbb_posts SET post_text = REPLACE(post_text, '[oldtag:', '[newtag:');
UPDATE phpbb_posts SET post_text = REPLACE(post_text, '[/oldtag:', '[/newtag:');
Make a backup of your _posts table before executing these SQL commands...just in case.
Replace the close-bracket with a colon? That's it?

User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: BBCode tags stored in phpbb_posts?

Post by Oyabun1 » Tue Mar 19, 2013 11:37 pm

No. What DionDesigns is suggesting is that if you have have a BBCode:
[color=#FF0000][before:[/color]3pkg1i5c] [i]text[/i] [color=#FF0000][/before:[/color]3pkg1i5c]
You could change just the parts in red, so that you will end up with:
[color=#FF0000][after:[/color]3pkg1i5c] [i]text[/i] [color=#FF0000][/after:[/color]3pkg1i5c]

Make sure you backup the database before trying it. You may also need to reparse the BBCodes after making the change. The Support Toolkit has a tool to do that.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests

User avatar
The Senator
Registered User
Posts: 151
Joined: Wed Jan 09, 2008 5:50 am

Re: BBCode tags stored in phpbb_posts?

Post by The Senator » Wed Mar 20, 2013 1:17 am

Oyabun1 wrote:No. What DionDesigns is suggesting is that if you have have a BBCode:
[color=#FF0000][before:[/color]3pkg1i5c] [i]text[/i] [color=#FF0000][/before:[/color]3pkg1i5c]
You could change just the parts in red, so that you will end up with:
[color=#FF0000][after:[/color]3pkg1i5c] [i]text[/i] [color=#FF0000][/after:[/color]3pkg1i5c]

Make sure you backup the database before trying it. You may also need to reparse the BBCodes after making the change. The Support Toolkit has a tool to do that.
Ah ha. Thanks for the explanation Dion, and the clarification Oyabun1 ;)

Locked

Return to “[3.0.x] Support Forum”