[wp-trac] [WordPress Trac] #41439: A super admin cannot remove themselves from a site

WordPress Trac noreply at wordpress.org
Wed Sep 20 12:54:38 UTC 2017


#41439: A super admin cannot remove themselves from a site
--------------------------+------------------------------
 Reporter:  johnbillion   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Users         |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  multisite
--------------------------+------------------------------

Comment (by birgire):

 Here's the restriction in {{{WP_Users_List_Table::single_row()}}} that
 prevents the current user to delete themselves from the current site:

 {{{
 if ( is_multisite() && get_current_user_id() != $user_object->ID &&
 current_user_can( 'remove_user', $user_object->ID ) )
         $actions['remove'] = "<a class='submitdelete' href='" .
 wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users'
 ) . "'>" . __( 'Remove' ) . "</a>";

 }}}

 https://github.com/WordPress/WordPress/blob/067970ca827ab970c846b522213a15c9c30ac131
 /wp-admin/includes/class-wp-users-list-table.php#L416

 If I understand correctly we want to allow this removal for the super
 admin only, maybe with:

 {{{
 if ( is_multisite() && ( get_current_user_id() != $user_object->ID ||
 current_user_can( 'manage_network' ) ) && current_user_can( 'remove_user',
 $user_object->ID ) )
         $actions['remove'] = "<a class='submitdelete' href='" .
 wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users'
 ) . "'>" . __( 'Remove' ) . "</a>";

 }}}

 I see no removal restrictions, for the current user, in {{{wp-
 admin/network/site-users.php}}}:

 https://github.com/WordPress/WordPress/blob/067970ca827ab970c846b522213a15c9c30ac131
 /wp-admin/network/site-users.php#L112-L133

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41439#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list