--- a/wp/wp-admin/includes/ms.php Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-admin/includes/ms.php Fri Sep 05 18:52:52 2025 +0200
@@ -1172,3 +1172,17 @@
'<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/admin/#network-admin-sites-screen">Documentation on Site Management</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support forums</a>' ) . '</p>';
}
+
+/**
+ * Stop execution if the role can not be assigned by the current user.
+ *
+ * @since 6.8.0
+ *
+ * @param string $role Role the user is attempting to assign.
+ */
+function wp_ensure_editable_role( $role ) {
+ $roles = get_editable_roles();
+ if ( ! isset( $roles[ $role ] ) ) {
+ wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 );
+ }
+}