While working with my most recent plugin, I had an issue of finding all the admins of a blog on the wpmu network. after a couple of minutes, I implemented a small hack and It worked like charm.
So here you go.
Please Note, I have used User level, which is backward compatible and is there because of the legacy plugins support(according to codex), But this hack solves the problem to iterate through the Roles/capabilities.
So here is the code.
function get_admin_users_for_blog($blog_id) {
global $wpdb;
$key="wp_".$blog_id."_user_level";
return $wpdb->get_results($wpdb->prepare("SELECT user_id from $wpdb->usermeta AS um WHERE um.meta_key ='". $key."' AND um.meta_value=10"));
}
//and now call it
global $current_blog;
$admins=get_admin_users_for_blog($current_blog->blog_id);
//now you have $admins as an array of object, Just Iterate over it and do some stuff, well, I will just print out
foreach($admins as $admin)
echo "ID:".$admin->ID;
///hmm you can use it for more productive reasons
That’s the shortest code I could produce, I know, The better way will be to loop through the capabilities, but hacks are for you know

![[blinklist]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/blinklist.png)
![[Bloglines]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/digg.png)
![[dzone]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/facebook.png)
![[Ma.gnolia]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/magnolia.png)
![[Mister Wong]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/misterwong.png)
![[Reddit]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/reddit.png)
![[Sphere]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/sphere.png)
![[Sphinn]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/sphinn.png)
![[StumbleUpon]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/technorati.png)
![[Email]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/email.png)

