Make WordPress Core


Ignore:
Timestamp:
03/02/2025 11:33:56 PM (13 months ago)
Author:
peterwilsoncc
Message:

Users: Use editable_roles filter for multisite sub-sites.

Adds a check of the editable_roles filter when adding users to a multisite sub-site to ensure the role is permitted to be used on the network. If the role is blocked by the filter, attempting to add the role will trigger a wp_die() similar to attempting to add a user with the role on a single site install.

Props eartboard, hareesh-pillai, ideag, sukhendu2002, spacedmonkey, thomaswm.
Fixes #43251.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-new.php

    r59784 r59901  
    7070    } else {
    7171        if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
     72
     73            wp_ensure_editable_role( $_REQUEST['role'] );
     74
    7275            $result = add_existing_user_to_blog(
    7376                array(
     
    225228                add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email.
    226229            }
     230
     231            wp_ensure_editable_role( $_REQUEST['role'] );
    227232
    228233            wpmu_signup_user(
Note: See TracChangeset for help on using the changeset viewer.