XF 2.1 Switch from dbtech [MENTION] bbcode (vBulletin) to [USER] xF2 - A simple query modify

Scandal

Well-known member
I'm working the migration of my sites from vBulletin 3 to XenForo 2.1 :)

I have stuck on this issue. On my vBulletin board we ran dbtech user tagging.
That system has the following own bbcode format:
Code:
[MENTION=123]Scandal[/MENTION]

This is very close to the xF2 one:
Code:
[USER=123]@Scandal[/USER]

... with the difference an "@" symbol.

So I want to update all my forum's posts to be normalized with the xF2 one.

The following queries are working, but I don't know how to apply the "@" inside the username. Any idea? Can someone improve the queries?
SQL:
UPDATE `xf_post` SET `message` = replace(message, '[MENTION=', '[USER=')
UPDATE `xf_post` SET `message` = replace(message, '[/MENTION]', '[/USER]')

Thanks :)
 
Could this be done using this? Any downsides?

AdminCP >> Setup >> Options >> Censoring

Code:
Word or phrase: [MENTION=
Replacement: [USER=

and

Code:
Word or phrase: [/MENTION]
Replacement: [/USER]
 
I'd still like to have my question above answered but whether or not the @ is displayed is a setting in XF2:

AdminCP >> Setup >> Options >> User alerts and notifications

At the bottom of that page, check or uncheck this option:

Keep @ character with user mentions
The @ character is used to initiate user mentions. If this option is disabled, successful user mentions will remove this character.
 
wow thanks, I didn't know that this option was exists on the control panel (y)
But I like the @ on every mention, for this reason I still asking for a solution. Is there any kind of query that can make the replaces like:
Code:
replace(message, '[MENTION={variable_part}]', '[USER={variable_part}]@')

We're talking about an importer xF2 board from vBulletin. Currently I'm working on localhost / testing boards. Any suggestion is welcomed. :)
 
I have as default checked the "Keep @ character with user mentions" which is what I need.
But as I can see on older posts of the imported board, the mentions still not have an "@". I think that this setting you noticed is for the "from now and then" posts.

I tried to uncheck the above setting but still not achieve what I need. I need the "@" in all user mentions, even if that was on an old post (imported from vBulletin database).
 
hmm, no, as I can see, the normalized way xF2 is applying the mentions is this:
Code:
[USER=8002]@Scandal[/USER]
The @ should be inside the bbcode. Sorry, I need it very clearly and normal. :giggle:
 
For anyone getting to this page in the future, here is the regex you can use:
Code:
^(\[MENTION=)([\d]+)(\])([\w]+)(\[\/MENTION\])/
Replacement:
Code:
[USER=$2]@$4[/USER]

You'll get a delimiter error... correct regex for those like me;

Quick find:
Code:
[MENTION
Regular expression:
Code:
/^(\[MENTION=)([\d]+)(\])([\w]+)(\[\/MENTION\])/
Replacement string:
Code:
[USER=$2]@$4[/USER]

Enjoy.
 
You'll get a delimiter error... correct regex for those like me;

Quick find:
Code:
[MENTION
Regular expression:
Code:
/^(\[MENTION=)([\d]+)(\])([\w]+)(\[\/MENTION\])/
Replacement string:
Code:
[USER=$2]@$4[/USER]

Enjoy.
For those with weird ascii character name tags, use this for the Regular expression:

Code:
/^(\[MENTION=)([\d]+)(\])([\W]+)(\[\/MENTION\])/
 
Back
Top Bottom