View Full Version : [vB3/vB4] VERY general SQL query via AdminCP to change usernames in quotes.
Max Taxable
06-24-2014, 10:00 PM
You gave someone a username change. Great, but his old username is still in all places where he was quoted in the past.
Run this query in AdminCP, replacing with actual usernamesUPDATE post SET pagetext = REPLACE(pagetext, '=old name', '=new name')
BUT: if there exists a apostrophe in the old username, the DB will think that's the end of the string and will kick a syntax error. Therefore where apostrophe exists in either username, double it, as such: ''
Example: UPDATE post SET pagetext = REPLACE(pagetext, '=Sammy''s', '=Elliot')
Where old name was: Sammy's and new name is: Elliot.
You're welcome.:D
mokujin
06-25-2014, 02:11 PM
Not tested, but try these ;-D
UPDATE post SET pagetext = REPLACE(pagetext, 'Sammy\'s', 'Elliot')
UPDATE post SET pagetext = REPLACE(pagetext, "Sammy's", "Elliot")
Max Taxable
06-25-2014, 02:12 PM
Not tested, but try these ;-D
UPDATE post SET pagetext = REPLACE(pagetext, 'Sammy\'\'s', 'Elliot')
UPDATE post SET pagetext = REPLACE(pagetext, "Sammy's", "Elliot")Those might work too. The one I posted did definitely work.:D
mokujin
06-25-2014, 02:14 PM
Oh wait, I thought you need help, but this is a how-to ;-))
Max Taxable
06-25-2014, 02:21 PM
Oh wait, I thought you need help, but this is a how-to ;-))Yep I had used this query before and never had problems. When it kicked the syntax error this morning, it took me a bit to figure out why.
So, just thought I would share in case anyone else wants to globally change quoted usernames, and needs a query to do it.
I smell a Hack coming here, one that does this automatically any time you change a username?
blind-eddie
07-20-2014, 11:30 PM
Would you happen to know what query to run to change username in other areas that do not change when a new name is applied?
--------------- Added 1405906738 at 1405906738 ---------------
Never mind, I went into the database and changed the names that needed changed in the areas that did not change the users name.
Max Taxable
07-21-2014, 01:12 AM
Would you happen to know what query to run to change username in other areas that do not change when a new name is applied?What areas are those, just out of curiosity. PMs quoted? Can add what you've figured out, to the article.
blind-eddie
07-21-2014, 01:17 AM
ibProArcade v2.7.2+
Max Taxable
07-21-2014, 01:29 AM
I wonder if that is true also for v3 Arcade.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.