Exclude admin from the top commenters list [duplicate]

Assuming the comment_author is a User ID, try:

if(user_can($result->comment_author,'manage_options')){
    $output .= "<li>".(($result->comment_author_url) ? "<a href="".$result->comment_author_url."">" : "").$result->comment_author.(($result->comment_author_url) ? "</a>" : "")." (".$result->comments_count.")</li>";
}

If not, one can use get_comment, and select the comment_ID in the SQL statement. You can then use the object returned to grab the user ID of the comments author, and do a check to see if they are an administrator using the user_can function from above.

http://codex.wordpress.org/Function_Reference/get_comment

edit:

  1. you need to the comment_ID. Modify your SQL query to retrieve this.
  2. inside the foreach loop, call get_comment which will return you a comment object. For an example see here
  3. From this comment object, grab the user ID of the commenter and assign it to a variable
  4. call user_can, passing the user ID you got in step 3. you need to check if the user can change options, which only an administrator can do, so we pass in ‘manage_options’ as the second parameter
  5. if user_can returns false, list the comment
  6. if user_can returns true, skip to the next comment, this is an administrator comment