Skip to content

Instantly share code, notes, and snippets.

@Lizdo
Created March 3, 2010 14:42
Show Gist options
  • Save Lizdo/320649 to your computer and use it in GitHub Desktop.
Save Lizdo/320649 to your computer and use it in GitHub Desktop.
<?php
$style = '';
$userid_array = $wp_user_search->get_results();
foreach ($userid_array as $userid ) {
$user_object = new WP_User($userid);
$roles = $user_object->roles;
$role = array_shift($roles);
$userobject_array[] = $user_object;
}
function cmp($a, $b)
{
if ($a->roles == $b->roles) {
if ($a->user_registered == $a->user_registered)
return 0;
else{
return ($a->user_registered < $b->user_registered) ? 1 : -1;
}
}
return ($a->roles < $b->roles) ? 1 : -1;
}
usort($userobject_array, "cmp");
foreach ($userobject_array as $user_object ) {
$roles = $user_object->roles;
$role = array_shift($roles);
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
echo "\n\t" . user_row($user_object, $style, $role);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment