prepare_items(); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '
' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '
' . '' . __('Info — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '
' . '' . __('Users — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '
' . '' . sprintf( __('Themes — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '
' . '' . __('Settings — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '
' ) ); get_current_screen()->set_help_sidebar( '' . __('For more information:') . '
' . '' . __('Documentation on Site Management') . '
' . '' . __('Support Forums') . '
' ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter site users list' ), 'heading_pagination' => __( 'Site users list navigation' ), 'heading_list' => __( 'Site users list' ), ) ); $_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( 'update', wp_get_referer() ); if ( ! empty( $_REQUEST['paged'] ) ) { $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); } $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; if ( ! $id ) wp_die( __('Invalid site ID.') ); $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); $is_main_site = is_main_site( $id ); switch_to_blog( $id ); $action = $wp_list_table->current_action(); if ( $action ) { switch ( $action ) { case 'newuser': check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); $user = $_POST['user']; if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { $update = 'err_new'; } else { $password = wp_generate_password( 12, false); $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); if ( false === $user_id ) { $update = 'err_new_dup'; } else { add_user_to_blog( $id, $user_id, $_POST['new_role'] ); $update = 'newuser'; /** * Fires after a user has been created via the network site-users.php page. * * @since 4.4.0 * * @param int $user_id ID of the newly created user. */ do_action( 'network_site_users_created_user', $user_id ); } } break; case 'adduser': check_admin_referer( 'add-user', '_wpnonce_add-user' ); if ( !empty( $_POST['newuser'] ) ) { $update = 'adduser'; $newuser = $_POST['newuser']; $user = get_user_by( 'login', $newuser ); if ( $user && $user->exists() ) { if ( ! is_user_member_of_blog( $user->ID, $id ) ) add_user_to_blog( $id, $user->ID, $_POST['new_role'] ); else $update = 'err_add_member'; } else { $update = 'err_add_notfound'; } } else { $update = 'err_add_notfound'; } break; case 'remove': if ( ! current_user_can( 'remove_users' ) ) { wp_die( __( 'Sorry, you are not allowed to remove users.' ), 403 ); } check_admin_referer( 'bulk-users' ); $update = 'remove'; if ( isset( $_REQUEST['users'] ) ) { $userids = $_REQUEST['users']; foreach ( $userids as $user_id ) { $user_id = (int) $user_id; remove_user_from_blog( $user_id, $id ); } } elseif ( isset( $_GET['user'] ) ) { remove_user_from_blog( $_GET['user'] ); } else { $update = 'err_remove'; } break; case 'promote': check_admin_referer( 'bulk-users' ); $editable_roles = get_editable_roles(); $role = false; if ( ! empty( $_REQUEST['new_role2'] ) ) { $role = $_REQUEST['new_role2']; } elseif ( ! empty( $_REQUEST['new_role'] ) ) { $role = $_REQUEST['new_role']; } if ( empty( $editable_roles[ $role ] ) ) { wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); } if ( isset( $_REQUEST['users'] ) ) { $userids = $_REQUEST['users']; $update = 'promote'; foreach ( $userids as $user_id ) { $user_id = (int) $user_id; // If the user doesn't already belong to the blog, bail. if ( ! is_user_member_of_blog( $user_id ) ) { wp_die( '' . __( 'One of the selected users is not a member of this site.' ) . '
', 403 ); } $user = get_userdata( $user_id ); $user->set_role( $role ); } } else { $update = 'err_promote'; } break; default: if ( ! isset( $_REQUEST['users'] ) ) { break; } check_admin_referer( 'bulk-users' ); $userids = $_REQUEST['users']; /** This action is documented in wp-admin/network/site-themes.php */ $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $userids, $id ); $update = $action; break; } wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); exit(); } restore_current_blog(); if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { wp_safe_redirect( $referer ); exit(); } add_screen_option( 'per_page' ); /* translators: %s: site name */ $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; /** * Filters whether to show the Add Existing User form on the Multisite Users screen. * * @since 3.1.0 * * @param bool $bool Whether to show the Add Existing User form. Default true. */ if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) wp_enqueue_script( 'user-suggest' ); require( ABSPATH . 'wp-admin/admin-header.php' ); ?>' . __( 'User added.' ) . '
' . __( 'User is already a member of this site.' ) . '
' . __( 'Enter the username of an existing user.' ) . '
' . __( 'Changed roles.' ) . '
' . __( 'Select a user to change role.' ) . '
' . __( 'User removed from this site.' ) . '
' . __( 'Select a user to remove.' ) . '
' . __( 'User created.' ) . '
' . __( 'Enter the username and email.' ) . '
' . __( 'Duplicated username or email address.' ) . '