I was searching online for a quick solution to retrieving a list of users from WordPress by role. I found a solution but decided to check the core user functions for a better alternative. As of WordPress 3.1, you can use the handy get_users() function.
Old Way
You had to create your own function that used the WP_User_Search() object.
function getUsersWithRole($role) {
$wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
return $wp_user_search->get_results();
}
$editors = getUsersWithRole('editor');
New Way
$editors = get_users('role=editor');