vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   General Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=189)
-   -   [vB3/vB4] VERY general SQL query via AdminCP to change usernames in quotes. (https://vborg.vbsupport.ru/showthread.php?t=312421)

Max Taxable 06-24-2014 10:00 PM

[vB3/vB4] VERY general SQL query via AdminCP to change usernames in quotes.
 
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.:D

mokujin 06-25-2014 02:11 PM

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"


Max Taxable 06-25-2014 02:12 PM

Quote:

Originally Posted by mokujin (Post 2503664)
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.: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

Quote:

Originally Posted by mokujin (Post 2503666)
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 [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.

Max Taxable 07-21-2014 01:12 AM

Quote:

Originally Posted by blind-eddie (Post 2507551)
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.


All times are GMT. The time now is 08:34 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.01128 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete