Disallow and hide user removal (as opposed to deletion) for single site installs. Removal is a multisite concept. Props nacin. fixes #16501 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@17439 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2011-02-10 20:37:26 +00:00
parent 81a1787248
commit e431f630a2
2 changed files with 15 additions and 6 deletions

View File

@ -121,10 +121,13 @@ class WP_Users_List_Table extends WP_List_Table {
function get_bulk_actions() { function get_bulk_actions() {
$actions = array(); $actions = array();
if ( !is_multisite() && current_user_can( 'delete_users' ) ) if ( is_multisite() ) {
$actions['delete'] = __( 'Delete' ); if ( current_user_can( 'remove_users' ) )
else $actions['remove'] = __( 'Remove' );
$actions['remove'] = __( 'Remove' ); } else {
if ( current_user_can( 'delete_users' ) )
$actions['delete'] = __( 'Delete' );
}
return $actions; return $actions;
} }

View File

@ -200,13 +200,16 @@ break;
case 'doremove': case 'doremove':
check_admin_referer('remove-users'); check_admin_referer('remove-users');
if ( ! is_multisite() )
wp_die( __( 'You can’t remove users.' ) );
if ( empty($_REQUEST['users']) ) { if ( empty($_REQUEST['users']) ) {
wp_redirect($redirect); wp_redirect($redirect);
exit; exit;
} }
if ( !current_user_can('remove_users') ) if ( ! current_user_can( 'remove_users' ) )
die(__('You can’t remove users.')); wp_die( __( 'You can’t remove users.' ) );
$userids = $_REQUEST['users']; $userids = $_REQUEST['users'];
@ -234,6 +237,9 @@ case 'remove':
check_admin_referer('bulk-users'); check_admin_referer('bulk-users');
if ( ! is_multisite() )
wp_die( __( 'You can’t remove users.' ) );
if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
wp_redirect($redirect); wp_redirect($redirect);
exit(); exit();