3 * Multisite sites administration panel.
6 * @subpackage Multisite
10 /** Load WordPress Administration Bootstrap */
11 require_once( dirname( __FILE__ ) . '/admin.php' );
13 if ( ! is_multisite() )
14 wp_die( __( 'Multisite support is not enabled.' ) );
16 if ( ! current_user_can( 'manage_sites' ) )
17 wp_die( __( 'You do not have permission to access this page.' ) );
19 $wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
20 $pagenum = $wp_list_table->get_pagenum();
22 $title = __( 'Sites' );
23 $parent_file = 'sites.php';
25 add_screen_option( 'per_page', array( 'label' => _x( 'Sites', 'sites per page (screen options)' ) ) );
27 get_current_screen()->add_help_tab( array(
29 'title' => __('Overview'),
31 '<p>' . __('Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.') . '</p>' .
32 '<p>' . __('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.') . '</p>' .
33 '<p>' . __('Hovering over each site reveals seven options (three for the primary site):') . '</p>' .
34 '<ul><li>' . __('An Edit link to a separate Edit Site screen.') . '</li>' .
35 '<li>' . __('Dashboard leads to the Dashboard for that site.') . '</li>' .
36 '<li>' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . '</li>' .
37 '<li>' . __('Delete which is a permanent action after the confirmation screens.') . '</li>' .
38 '<li>' . __('Visit to go to the frontend site live.') . '</li></ul>' .
39 '<p>' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '</p>' .
40 '<p>' . __('Clicking on bold headings can re-sort this table.') . '</p>'
43 get_current_screen()->set_help_sidebar(
44 '<p><strong>' . __('For more information:') . '</strong></p>' .
45 '<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
46 '<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
49 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
51 if ( isset( $_GET['action'] ) ) {
52 /** This action is documented in wp-admin/network/edit.php */
53 do_action( 'wpmuadminedit' );
55 if ( 'confirm' === $_GET['action'] ) {
56 check_admin_referer( 'confirm' );
58 if ( ! headers_sent() ) {
60 header( 'Content-Type: text/html; charset=utf-8' );
62 if ( $current_site->blog_id == $id )
63 wp_die( __( 'You are not allowed to change the current site.' ) );
66 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
68 <meta name="viewport" content="width=device-width" />
69 <title><?php _e( 'WordPress › Confirm your action' ); ?></title>
71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
73 wp_admin_css( 'install', true );
74 wp_admin_css( 'ie', true );
77 <body class="wp-core-ui">
78 <h1 id="logo"><a href="<?php echo esc_url( __( 'http://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></h1>
79 <form action="sites.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
80 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
81 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
82 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
83 <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?>
84 <p><?php echo esc_html( wp_unslash( $_GET['msg'] ) ); ?></p>
85 <?php submit_button( __('Confirm'), 'button' ); ?>
95 $manage_actions = array( 'deleteblog', 'allblogs', 'archiveblog', 'unarchiveblog', 'activateblog', 'deactivateblog', 'unspamblog', 'spamblog', 'unmatureblog', 'matureblog' );
96 if ( in_array( $_GET['action'], $manage_actions ) ) {
97 $action = $_GET['action'];
98 if ( 'allblogs' === $action )
99 $action = 'bulk-sites';
101 check_admin_referer( $action );
104 switch ( $_GET['action'] ) {
107 if ( ! current_user_can( 'delete_sites' ) )
108 wp_die( __( 'You do not have permission to access this page.' ) );
110 $updated_action = 'not_deleted';
111 if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
112 wpmu_delete_blog( $id, true );
113 $updated_action = 'delete';
118 if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) {
119 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
121 foreach ( (array) $_POST['allblogs'] as $key => $val ) {
122 if ( $val != '0' && $val != $current_site->blog_id ) {
123 switch ( $doaction ) {
125 if ( ! current_user_can( 'delete_site', $val ) )
126 wp_die( __( 'You are not allowed to delete the site.' ) );
128 $updated_action = 'all_delete';
129 wpmu_delete_blog( $val, true );
134 $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam';
135 update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' );
139 wp_die( __( 'You are not allowed to change the current site.' ) );
143 wp_redirect( network_admin_url( 'sites.php' ) );
149 case 'unarchiveblog':
150 update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' );
154 update_blog_status( $id, 'deleted', '0' );
155 do_action( 'activate_blog', $id );
158 case 'deactivateblog':
159 do_action( 'deactivate_blog', $id );
160 update_blog_status( $id, 'deleted', '1' );
165 update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' );
170 update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' );
174 if ( empty( $updated_action ) && in_array( $_GET['action'], $manage_actions ) )
175 $updated_action = $_GET['action'];
177 if ( ! empty( $updated_action ) ) {
178 wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) );
184 if ( isset( $_GET['updated'] ) ) {
185 switch ( $_GET['updated'] ) {
187 $msg = __( 'Sites removed from spam.' );
190 $msg = __( 'Sites marked as spam.' );
193 $msg = __( 'Sites deleted.' );
196 $msg = __( 'Site deleted.' );
199 $msg = __( 'You do not have permission to delete that site.' );
202 $msg = __( 'Site archived.' );
204 case 'unarchiveblog':
205 $msg = __( 'Site unarchived.' );
208 $msg = __( 'Site activated.' );
210 case 'deactivateblog':
211 $msg = __( 'Site deactivated.' );
214 $msg = __( 'Site removed from spam.' );
217 $msg = __( 'Site marked as spam.' );
220 $msg = apply_filters( 'network_sites_updated_message_' . $_GET['updated'], __( 'Settings saved.' ) );
224 if ( ! empty( $msg ) )
225 $msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>';
228 $wp_list_table->prepare_items();
230 require_once( ABSPATH . 'wp-admin/admin-header.php' );
234 <h2><?php _e( 'Sites' ) ?>
236 <?php if ( current_user_can( 'create_sites') ) : ?>
237 <a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
240 <?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) {
241 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) );
247 <form action="" method="get" id="ms-search">
248 <?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?>
249 <input type="hidden" name="action" value="blogs" />
252 <form id="form-site-list" action="sites.php?action=allblogs" method="post">
253 <?php $wp_list_table->display(); ?>
258 require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?>