Separate user deletion and removal. Add promote_users cap so that multisite Admins (not supes) can promote. see #13074

git-svn-id: http://svn.automattic.com/wordpress/trunk@14176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2010-04-21 17:43:53 +00:00
parent 8ce9670189
commit fda80bc7f6
4 changed files with 121 additions and 28 deletions

View File

@@ -609,6 +609,7 @@ function populate_roles_300() {
$role->add_cap( 'update_core' );
$role->add_cap( 'remove_users' );
$role->add_cap( 'add_users' );
$role->add_cap( 'promote_users' );
$role->add_cap( 'edit_theme_options' );
}
}

View File

@@ -1823,14 +1823,12 @@ function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
// Set up the hover actions for this user
$del_cap_type = 'remove';
if ( !is_multisite() && current_user_can('delete_users') )
$del_cap_type = 'delete';
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
if ( $current_user->ID != $user_object->ID && current_user_can( $del_cap_type . '_user', $user_object->ID ) )
if ( !is_multisite() && $current_user->ID != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
if ( is_multisite() && $current_user->ID != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . "</a>";
$actions = apply_filters('user_row_actions', $actions, $user_object);
$action_count = count($actions);
$i = 0;