Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

While moving a client's WP site to a new host (single site, not multi), I found that Dashboard>>Users lists two admin accounts (above the detailed shows All(2) Administrator (2) ) but only shows one in the detailed list below; and only one admin account shows in the wp_users table with the ID of 1. Where is this extra admin account? And how do I remove it?

(No need to warn me about security: there are no signs of hacking to the account, and in moving to the new host, all passwords have been changed, security tweaked up, fresh 3.0.4 core files uploaded and the database dump shows only one admin.)

share|improve this question
    
where exactly did you find that the users lists two admins? –  Bainternet Feb 5 '11 at 15:09
    
Are you using multi-site or single site? –  hakre Feb 5 '11 at 15:26
    
Deleted my original comment, i've wrapped it into an answer instead. –  t31os Feb 5 '11 at 19:36
    
My wordpress users also happened the same problem. Your answers are very important for me. –  user4760 Apr 19 '11 at 0:39
add comment

2 Answers

up vote 3 down vote accepted

That's typically the result of users deleting accounts directly in the database. The functions that count users queries to the usermeta table to determine how many users are of a given type, when users do manual deletion they often forget to remove relational data left in the meta table, which in turn throws off the counts.

Images below are to show how what i've said above is true(though i'll admit there's always a chance this isn't the problem you're experiencing).

Two admins

Two admins

Deleting a user record

Deleting the user record in the users table

Viewing the list of admins after user record deletion

Seeing the misreported admin count

If you want to check the installation for redundant user meta, you could find user IDs that don't have a corresponding record in the users table in PhpMyAdmin using some SQL.

 SELECT DISTINCT user_id FROM wp_usermeta WHERE NOT EXISTS(SELECT ID FROM wp_users WHERE ID = user_id)

If you'd like that query wrapped into some WP ready code, just ask.. :)

share|improve this answer
    
t31os, Thanks for the extensive answer, but I haven't deleted users directly in the DB. Someone may have before I got the site; and the invisible admin exisited before I dumped the DB and moved it to the new server. Only one user shows up in the DB dump and via phpmyadmin. How would I use that query to echo out the user_id's? Thanks. –  songdogtech Feb 8 '11 at 14:44
    
In phpmyadmin select the WP database then click on the SQL tab, now copy the code into the box and hit Go. I can wrap it into a $wpdb query for you, but it's easier to use phpmyadmin if you have access(do you have access to phpmyadmin?). –  t31os Feb 8 '11 at 15:05
    
Arg...too little coffee last time. I use phpmyadmin a lot, but still learning it. Ran that, found a user_id 5 row with this: <b id="user_superuser"><script language="JavaScript">var setUserName = function(){ try{ var t=document.getElementById("user_superuser"); while(t.nodeName!="TR"){t=t.parentNode; etc.... Must be old hacking code from when the site was at NetSol. I can delete that whole row, right? –  songdogtech Feb 27 '11 at 20:51
    
Considering what's in that record, i would. :) –  t31os Feb 27 '11 at 22:17
    
Experienced the same problem, had figured it was due to manual deletion - thanks for the insight as to how WP counts users and thanks for the query! +1 –  Johannes Pille Jun 6 '12 at 10:24
add comment

This is probably a bug. Something similar had been reported in Ticket #16367: The number displayed above the list did not match the entries in the list:

The count is cached and updated twice daily. This is not a live count.

Probably you need to wait some more hours until it's correct if you're using the multi-site and talking about super-admins.

If not and you can still reproduce the problem, please report it to the wordpress project as this might be a bug which needs to be fixed first.

share|improve this answer
    
The code (get_user_count() in wp-includes/ms-functions.php) is using a cache life of 1 hour. –  Peter Rowell Feb 5 '11 at 16:21
    
Huh, I can't seem to find that function anywhere. Did you mean count_users() in wp-includes/user.php? It definitely is not doing any caching. –  Peter Rowell Feb 5 '11 at 17:18
    
@Peter Rowell: Yeah, I meant that one, sure. This is the function in question for the standard users admin page in single-site. –  hakre Feb 5 '11 at 17:23
    
The extra, hidden admin is still there after a few hours. It's a single site, not multi. Will wait longer and see. –  songdogtech Feb 5 '11 at 18:14
    
@songdogtech: If it's single-side this has nothing to do with caching, so no need for your to wait longer. There is some other reason why it's not displayed properly. Have you deactivated all plugins and all non-default themes? –  hakre Feb 5 '11 at 18:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.