Announcement

Collapse
No announcement yet.

changing username in db syntax help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • changing username in db syntax help

    I am wondering if there is a way to go into the database and change all the instances of a particular member name to that person's new name in the current posts?

  • #2
    After renaming a user you need to run this:

    Admin CP -> Maintenance -> Update Counters -> Update User Names

    Comment


    • #3
      That doesn't do what I wanted though. (i didn't actually see anything done).

      For example if I changed my name to Rosey here and someone had been talking to me and said "hey deirdre, I like your avatar."

      I want to run a query that basically does: whenever you see the name Deirdre in posts, change it to Rosey.

      Is that possible?

      Comment


      • #4
        Try this query...
        Code:
        UPDATE 
            post
        SET 
            pagetext = replace(pagetext,'oldname', 'newname') 
        WHERE 
            pagetext LIKE '%oldname%'
        Lats...

        Comment


        • #5
          Be very careful when you run the query that Lats suggested, because if you are updating a user name that could be part of a regular word, then you will mess up many posts.

          If the user name is a common part of a word, it would be best to only update the quoted part of any post where that member was quoted.

          Here is an example:

          UPDATE post SET pagetext = REPLACE(pagetext, '=oldname', '=newname')

          Change oldname and newname as needed.

          Comment


          • #6
            That's a good warning there Andy, should have mentioned that myself.
            Lats...

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X