• Hey,

    All right, a little back story first. ??

    A few years ago I deiced to start a blog for school. At the time it was private and on a intranet domain. I’ve left hundred of comments over the years. Of course since then, all of my account information has changed, and multiple times at that. That is, my posting name (user name), E-mail, and URI.

    Today I use plug-ins such as Author Highlight, which help my comments stick out from the rest. That is, so it’s easy to tell when I, the lone administrator, has left an official comment.

    So now I would like to change the SQL data for all of my old comments so that they all have my valid account information. With the bonus being, that Author Highlight and other plug-ins will work for all comments, instead of just new ones that include my updated account information.

    I believe an SQL query will do this easily, the problem being I am a complete newbie and have no clue where I would even begin. Basicly, I only now how to display data.

    Which is like this:

    SELECT *
    FROM
    wp_comments
    WHERE
    comment_author = 'oldAuthor'
    OR
    comment_author = 'newAuthor'
    AND
    comment_author_email = '[email protected]'
    OR
    comment_author_email = '[email protected]'
    AND
    comment_author_url = 'https://www.oldsite.com/'
    OR
    comment_author_url = 'https://www.newsite.com/'
    ORDER BY
    comment_ID ASC
    LIMIT 0 , 30

    380 Total

    So those 380 are all of my comments.

    All the old ones need to be updated with my new account information.

    Wow, that would suck big time having to do it by hand. Got to love the power of SQL. ??

    Thanks a lot,

    Will

Viewing 2 replies - 1 through 2 (of 2 total)
  • This will work:

    update
    wp_comments
    set
    comment_author='NEW_AUTHOR',
    comment_author_email='NEW_EMAIL',
    comment_author_url='NEW_URL'
    where
    comment_author='OLD_AUTHOR'
    ;

    Thread Starter war59312

    (@war59312)

    All right sweet! ??

    Thanks a lot.

    Worked great! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SQL query to update account information?’ is closed to new replies.