Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > General Articles
[vB3/vB4] VERY general SQL query via AdminCP to change usernames in quotes.
Max Taxable's Avatar
Max Taxable
Join Date: Feb 2011
Posts: 3,134

 

Show Printable Version Email this Page Subscription
Max Taxable Max Taxable is offline 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 usernames
HTML Code:
UPDATE 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:
HTML Code:
UPDATE post SET pagetext = REPLACE(pagetext, '=Sammy''s', '=Elliot')
Where old name was: Sammy's and new name is: Elliot.


You're welcome.
Reply With Quote
  #2  
Old 06-25-2014, 02:11 PM
mokujin's Avatar
mokujin mokujin is offline
 
Join Date: Oct 2005
Location: Czech
Posts: 345
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not tested, but try these ;-D
PHP Code:
UPDATE post SET pagetext REPLACE(pagetext'Sammy\'s''Elliot'
PHP Code:
UPDATE post SET pagetext REPLACE(pagetext"Sammy's""Elliot"
Reply With Quote
  #3  
Old 06-25-2014, 02:12 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mokujin View Post
Not tested, but try these ;-D
PHP Code:
UPDATE post SET pagetext REPLACE(pagetext'Sammy\'\'s''Elliot'
PHP Code:
UPDATE post SET pagetext REPLACE(pagetext"Sammy's""Elliot"
Those might work too. The one I posted did definitely work.
Reply With Quote
  #4  
Old 06-25-2014, 02:14 PM
mokujin's Avatar
mokujin mokujin is offline
 
Join Date: Oct 2005
Location: Czech
Posts: 345
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh wait, I thought you need help, but this is a how-to ;-))
Reply With Quote
Благодарность от:
Max Taxable
  #5  
Old 06-25-2014, 02:21 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mokujin View Post
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?
Reply With Quote
  #6  
Old 07-20-2014, 11:30 PM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 [DATE]1405906738[/DATE] at [TIME]1405906738[/TIME] ---------------

Never mind, I went into the database and changed the names that needed changed in the areas that did not change the users name.
Reply With Quote
  #7  
Old 07-21-2014, 01:12 AM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by blind-eddie View Post
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.
Reply With Quote
  #8  
Old 07-21-2014, 01:17 AM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ibProArcade v2.7.2+
Reply With Quote
Благодарность от:
Max Taxable
  #9  
Old 07-21-2014, 01:29 AM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wonder if that is true also for v3 Arcade.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:05 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04927 seconds
  • Memory Usage 2,285KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_html
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (4)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete