Share and Enjoy

Admin avatars not showing up in comments after switching the admin user?

Lets say, you posted 5 posts and 3 comments with user admin with the same user. Your email address for this user was x@yoursite.com. Now you read the WordPress admin security article here and decided that you should delete the admin user.

  1. Create another administrator in the admin area.
  2. Log out of the back end.
  3. Log in as the new user.
  4. Delete the old admin from the user list.
    A second user gives greater security: that name will be displayed in all future published articles and commentaries, and the name of the actual administrator will never be displayed on blog pages and therefore never communicated to the outside world.

wordpress_delete_user

When you’ve done it,  everything seems to be fine. Except your avatar is not showing up in the comments you made. Changing the email address of the new user won’t work. Now you have to do a bit of manual work.

In order to solve this issue, you will have to connect to your database. You can use phpMyAdmin for it. Go to phpMyAdmin, select your WordPress database and click on the SQL Tab

phpmyadmin

At this stage you should know two variables,

  1. Your table Prefix
    You can find the table prefix in wp-congfig.php, search for $table_prefix = ‘XXX_’, and copy its value (XXX_ without quotes).
  2. User ID of your newly created admin user
    If that was the second user you added, it must be a 2, but if you are not sure, enter the following query in the Text box right under SQL tab, as shown in above image.

    select ID from XXX_users where user_login = 'YOURNEWUSERNAMEHERE'

Replace the XXX_ with your Table prefix and click the GO button, right under the text box. This will get you a table on next page like in the image below

phpmyadmin2

Copy the number marked with red circle, and now you have your new user’s ID. Lets proceed with fixing the avater part. Go back to previous page on your browser and enter the following SQL in the text box,

update XXX_comments set user_id = Y where user_id = 1

Replace the Y with the ID you got in the last step and press the GO button. This should fix the problem you were having. Feel free to post in comments any questions you may have.

Enjoyed this Post?

Share and Enjoy

Facebook Feeds