26 get_current_screen()->add_help_tab( |
26 get_current_screen()->add_help_tab( |
27 array( |
27 array( |
28 'id' => 'overview', |
28 'id' => 'overview', |
29 'title' => __( 'Overview' ), |
29 'title' => __( 'Overview' ), |
30 'content' => |
30 'content' => |
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>' . |
31 '<p>' . __( 'Add New Site takes you to the screen for adding a new site to the network. 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>' . |
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>' . |
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>' . |
34 '<ul><li>' . __( 'An Edit link to a separate Edit Site screen.' ) . '</li>' . |
35 '<li>' . __( 'Dashboard leads to the Dashboard for that site.' ) . '</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>' . |
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>' . |
37 '<li>' . __( 'Delete which is a permanent action after the confirmation screen.' ) . '</li>' . |
38 '<li>' . __( 'Visit to go to the front-end site live.' ) . '</li></ul>' . |
38 '<li>' . __( 'Visit to go to the front-end of the live site.' ) . '</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>', |
|
41 ) |
39 ) |
42 ); |
40 ); |
43 |
41 |
44 get_current_screen()->set_help_sidebar( |
42 get_current_screen()->set_help_sidebar( |
45 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
43 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
46 '<p>' . __( '<a href="https://wordpress.org/support/article/network-admin-sites-screen/">Documentation on Site Management</a>' ) . '</p>' . |
44 '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/admin/#network-admin-sites-screen">Documentation on Site Management</a>' ) . '</p>' . |
47 '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>' |
45 '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support forums</a>' ) . '</p>' |
48 ); |
46 ); |
49 |
47 |
50 get_current_screen()->set_screen_reader_content( |
48 get_current_screen()->set_screen_reader_content( |
51 array( |
49 array( |
52 'heading_pagination' => __( 'Sites list navigation' ), |
50 'heading_pagination' => __( 'Sites list navigation' ), |
100 if ( ! headers_sent() ) { |
98 if ( ! headers_sent() ) { |
101 nocache_headers(); |
99 nocache_headers(); |
102 header( 'Content-Type: text/html; charset=utf-8' ); |
100 header( 'Content-Type: text/html; charset=utf-8' ); |
103 } |
101 } |
104 |
102 |
105 if ( get_network()->site_id == $id ) { |
103 if ( is_main_site( $id ) ) { |
106 wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
104 wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
107 } |
105 } |
108 |
106 |
109 $site_details = get_site( $id ); |
107 $site_details = get_site( $id ); |
110 $site_address = untrailingslashit( $site_details->domain . $site_details->path ); |
108 $site_address = untrailingslashit( $site_details->domain . $site_details->path ); |
116 <form action="sites.php?action=<?php echo esc_attr( $site_action ); ?>" method="post"> |
114 <form action="sites.php?action=<?php echo esc_attr( $site_action ); ?>" method="post"> |
117 <input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> |
115 <input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> |
118 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
116 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
119 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> |
117 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> |
120 <?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> |
118 <?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> |
121 <p><?php printf( $manage_actions[ $site_action ], $site_address ); ?></p> |
119 <?php |
122 <?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
120 if ( 'deleteblog' === $site_action ) { |
|
121 $submit = __( 'Delete this site permanently' ); |
|
122 ?> |
|
123 <div class="notice notice-warning inline"> |
|
124 <p><?php _e( 'Deleting a site is a permanent action that cannot be undone. This will delete the entire site and its uploads directory.' ); ?> |
|
125 </div> |
|
126 <?php |
|
127 } else { |
|
128 $submit = __( 'Confirm' ); |
|
129 } |
|
130 ?> |
|
131 <p><?php printf( $manage_actions[ $site_action ], "<strong>{$site_address}</strong>" ); ?></p> |
|
132 <?php submit_button( $submit, 'primary' ); ?> |
123 </form> |
133 </form> |
124 </div> |
134 </div> |
125 <?php |
135 <?php |
126 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
136 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
127 exit; |
137 exit; |
140 if ( ! current_user_can( 'delete_sites' ) ) { |
150 if ( ! current_user_can( 'delete_sites' ) ) { |
141 wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
151 wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
142 } |
152 } |
143 |
153 |
144 $updated_action = 'not_deleted'; |
154 $updated_action = 'not_deleted'; |
145 if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) { |
155 if ( 0 !== $id && ! is_main_site( $id ) && current_user_can( 'delete_site', $id ) ) { |
146 wpmu_delete_blog( $id, true ); |
156 wpmu_delete_blog( $id, true ); |
147 $updated_action = 'delete'; |
157 $updated_action = 'delete'; |
148 } |
158 } |
149 break; |
159 break; |
150 |
160 |
152 check_admin_referer( 'ms-delete-sites' ); |
162 check_admin_referer( 'ms-delete-sites' ); |
153 |
163 |
154 foreach ( (array) $_POST['site_ids'] as $site_id ) { |
164 foreach ( (array) $_POST['site_ids'] as $site_id ) { |
155 $site_id = (int) $site_id; |
165 $site_id = (int) $site_id; |
156 |
166 |
157 if ( get_network()->site_id == $site_id ) { |
167 if ( is_main_site( $site_id ) ) { |
158 continue; |
168 continue; |
159 } |
169 } |
160 |
170 |
161 if ( ! current_user_can( 'delete_site', $site_id ) ) { |
171 if ( ! current_user_can( 'delete_site', $site_id ) ) { |
162 $site = get_site( $site_id ); |
172 $site = get_site( $site_id ); |
179 |
189 |
180 case 'allblogs': |
190 case 'allblogs': |
181 if ( isset( $_POST['action'] ) && isset( $_POST['allblogs'] ) ) { |
191 if ( isset( $_POST['action'] ) && isset( $_POST['allblogs'] ) ) { |
182 $doaction = $_POST['action']; |
192 $doaction = $_POST['action']; |
183 |
193 |
184 foreach ( (array) $_POST['allblogs'] as $key => $val ) { |
194 foreach ( (array) $_POST['allblogs'] as $site_id ) { |
185 if ( '0' != $val && get_network()->site_id != $val ) { |
195 $site_id = (int) $site_id; |
|
196 |
|
197 if ( 0 !== $site_id && ! is_main_site( $site_id ) ) { |
186 switch ( $doaction ) { |
198 switch ( $doaction ) { |
187 case 'delete': |
199 case 'delete': |
188 require_once ABSPATH . 'wp-admin/admin-header.php'; |
200 require_once ABSPATH . 'wp-admin/admin-header.php'; |
189 ?> |
201 ?> |
190 <div class="wrap"> |
202 <div class="wrap"> |
195 <?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?> |
207 <?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?> |
196 <p><?php _e( 'You are about to delete the following sites:' ); ?></p> |
208 <p><?php _e( 'You are about to delete the following sites:' ); ?></p> |
197 <ul class="ul-disc"> |
209 <ul class="ul-disc"> |
198 <?php |
210 <?php |
199 foreach ( $_POST['allblogs'] as $site_id ) : |
211 foreach ( $_POST['allblogs'] as $site_id ) : |
|
212 $site_id = (int) $site_id; |
|
213 |
200 $site = get_site( $site_id ); |
214 $site = get_site( $site_id ); |
201 $site_address = untrailingslashit( $site->domain . $site->path ); |
215 $site_address = untrailingslashit( $site->domain . $site->path ); |
202 ?> |
216 ?> |
203 <li> |
217 <li> |
204 <?php echo $site_address; ?> |
218 <?php echo $site_address; ?> |
205 <input type="hidden" name="site_ids[]" value="<?php echo (int) $site_id; ?>" /> |
219 <input type="hidden" name="site_ids[]" value="<?php echo esc_attr( $site_id ); ?>" /> |
206 </li> |
220 </li> |
207 <?php endforeach; ?> |
221 <?php endforeach; ?> |
208 </ul> |
222 </ul> |
209 <?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
223 <?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
210 </form> |
224 </form> |
365 |
386 |
366 <div class="wrap"> |
387 <div class="wrap"> |
367 <h1 class="wp-heading-inline"><?php _e( 'Sites' ); ?></h1> |
388 <h1 class="wp-heading-inline"><?php _e( 'Sites' ); ?></h1> |
368 |
389 |
369 <?php if ( current_user_can( 'create_sites' ) ) : ?> |
390 <?php if ( current_user_can( 'create_sites' ) ) : ?> |
370 <a href="<?php echo esc_url( network_admin_url( 'site-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> |
391 <a href="<?php echo esc_url( network_admin_url( 'site-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Add New Site' ); ?></a> |
371 <?php endif; ?> |
392 <?php endif; ?> |
372 |
393 |
373 <?php |
394 <?php |
374 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
395 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
375 echo '<span class="subtitle">'; |
396 echo '<span class="subtitle">'; |