Ticket #15800: 15800.2.patch
File 15800.2.patch, 10.0 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/ms.php
diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php index 6e8fb07..1657da2 100644
a b 1124 1124 </script> 1125 1125 <?php 1126 1126 } 1127 1128 /** 1129 * Output the HTML for a network's "Edit Site" tabular interface 1130 * 1131 * @since 4.6.0 1132 * 1133 * @link https://core.trac.wordpress.org/ticket/15800 discussion 1134 * 1135 * @param $args { 1136 * Optional. Array or string of Query parameters. 1137 * 1138 * @type int $blog_id The site ID. Default is the current site. 1139 * @type string|array $before The HTML to echo before the tabs 1140 * @type string|array $after The HTML to echo after the tabs 1141 * @type array $tabs The tabs to include with (label|url|cap) keys 1142 * @type array $screen_tabs Pre-rendered HTML tabs if you wish to own their output 1143 * } 1144 */ 1145 function network_edit_site_tabs( $args = array() ) { 1146 global $pagenow; 1147 1148 /** 1149 * Filter the tabs that appear on site-editing network pages 1150 * 1151 * Default tabs: 'site-info', 'site-users', 'site-themes', and 'site-settings' 1152 * 1153 * @since 4.6.0 1154 * 1155 * @param array $search_columns Array of column names to be searched. 1156 * @param string $search Text being searched. 1157 * @param WP_User_Query $this The current WP_User_Query instance. 1158 */ 1159 $tabs = apply_filters( 'network_edit_site_tabs', array( 1160 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php', 'cap' => 'manage_site_info' ), 1161 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php', 'cap' => 'manage_site_users' ), 1162 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php', 'cap' => 'manage_site_themes' ), 1163 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_site_settings' ) 1164 ) ); 1165 1166 // Parse arguments 1167 $r = wp_parse_args( $args, array( 1168 'blog_id' => 0, 1169 'before' => '<h2 class="nav-tab-wrapper wp-clearfix" role="tablist">', 1170 'after' => '</h2>', 1171 'tabs' => $tabs, 1172 'screen_tabs' => array() 1173 ) ); 1174 1175 /** 1176 * Filter the arguments used to output tabs that appear on site-editing network pages 1177 * 1178 * @since 4.6.0 1179 * 1180 * @param array $r Parsed arguments 1181 * @param array $args Original arguments 1182 */ 1183 $r = apply_filters( 'network_edit_site_tabs_args', $r, $args ); 1184 1185 // Loop through tabs 1186 foreach ( $r['tabs'] as $tab_id => $tab ) { 1187 1188 // Skip tab if user can't access 1189 if ( ! current_user_can( $tab['cap'], $r['blog_id'] ) ) { 1190 continue; 1191 } 1192 1193 // Skip if tab is pre-loaded 1194 if ( isset( $r['screen_tabs'][ $tab_id ] ) ) { 1195 continue; 1196 } 1197 1198 // Is this tab active? 1199 $class = ( $tab['url'] === $pagenow ) 1200 ? ' nav-tab-active' 1201 : ''; 1202 1203 // Aria selected 1204 $selected = ( $tab['url'] === $pagenow ) 1205 ? 'true' 1206 : 'false'; 1207 1208 // Get the URL for this tab 1209 $url = add_query_arg( array( 'id' => $r['blog_id'] ), network_admin_url( $tab['url'] ) ); 1210 1211 // Add tab to screen tabs 1212 $r['screen_tabs'][ $tab_id ] = '<a href="' . esc_url( $url ) . '" class="nav-tab' . esc_attr( $class ) . '" aria-controls="' . sanitize_title( $tab_id ) . '" aria-selected="' . esc_attr( $selected ) . '">' . esc_html( $tab['label'] ) . '</a>'; 1213 } 1214 1215 // Start a buffer 1216 ob_start(); 1217 1218 // All done! 1219 echo $r['before']; 1220 echo implode( '', $r['screen_tabs'] ); 1221 echo $r['after']; 1222 1223 // Put out the tabs 1224 ob_end_flush(); 1225 } -
src/wp-admin/network/site-info.php
diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php index b18d804..e9e7b57 100644
a b 14 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 15 } 16 16 17 if ( ! current_user_can( 'manage_site s' ) ) {17 if ( ! current_user_can( 'manage_site_info' ) ) { 18 18 wp_die( __( 'You do not have sufficient permissions to edit this site.' ) ); 19 19 } 20 20 … … 143 143 <div class="wrap"> 144 144 <h1 id="edit-site"><?php echo $title; ?></h1> 145 145 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 146 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">147 146 <?php 148 $tabs = array( 149 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 150 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 151 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 152 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 153 ); 154 foreach ( $tabs as $tab_id => $tab ) { 155 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 156 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 157 } 158 ?> 159 </h2> 160 <?php 147 148 network_edit_site_tabs( array( 'blog_id' => $id ) ); 149 161 150 if ( ! empty( $messages ) ) { 162 151 foreach ( $messages as $msg ) { 163 152 echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; -
src/wp-admin/network/site-settings.php
diff --git a/src/wp-admin/network/site-settings.php b/src/wp-admin/network/site-settings.php index b945ea7..86985a4 100644
a b 13 13 if ( ! is_multisite() ) 14 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 15 16 if ( ! current_user_can( 'manage_site s' ) )16 if ( ! current_user_can( 'manage_site_settings' ) ) 17 17 wp_die( __( 'You do not have sufficient permissions to edit this site.' ) ); 18 18 19 19 get_current_screen()->add_help_tab( array( … … 95 95 <div class="wrap"> 96 96 <h1 id="edit-site"><?php echo $title; ?></h1> 97 97 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 98 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix"> 98 99 99 <?php 100 $tabs = array( 101 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 102 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 103 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 104 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 105 ); 106 foreach ( $tabs as $tab_id => $tab ) { 107 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 108 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 109 } 110 ?> 111 </h2> 112 <?php 100 101 network_edit_site_tabs( array( 'blog_id' => $id ) ); 102 113 103 if ( ! empty( $messages ) ) { 114 104 foreach ( $messages as $msg ) 115 105 echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; -
src/wp-admin/network/site-themes.php
diff --git a/src/wp-admin/network/site-themes.php b/src/wp-admin/network/site-themes.php index d48e2ca..fadea0d 100644
a b 13 13 if ( ! is_multisite() ) 14 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 15 16 if ( ! current_user_can( 'manage_site s' ) )16 if ( ! current_user_can( 'manage_site_themes' ) ) 17 17 wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) ); 18 18 19 19 get_current_screen()->add_help_tab( array( … … 149 149 <div class="wrap"> 150 150 <h1 id="edit-site"><?php echo $title; ?></h1> 151 151 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 152 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">153 152 <?php 154 $tabs = array( 155 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 156 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 157 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 158 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 159 ); 160 foreach ( $tabs as $tab_id => $tab ) { 161 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 162 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 163 } 164 ?> 165 </h2><?php 153 154 network_edit_site_tabs( array( 'blog_id' => $id ) ); 166 155 167 156 if ( isset( $_GET['enabled'] ) ) { 168 157 $enabled = absint( $_GET['enabled'] ); -
src/wp-admin/network/site-users.php
diff --git a/src/wp-admin/network/site-users.php b/src/wp-admin/network/site-users.php index 77122e8..922528b 100644
a b 13 13 if ( ! is_multisite() ) 14 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 15 16 if ( ! current_user_can( 'manage_sites') )16 if ( ! current_user_can( 'manage_site_users' ) ) 17 17 wp_die(__('You do not have sufficient permissions to edit this site.')); 18 18 19 19 $wp_list_table = _get_list_table('WP_Users_List_Table'); … … 204 204 <div class="wrap"> 205 205 <h1 id="edit-site"><?php echo $title; ?></h1> 206 206 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 207 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">208 207 <?php 209 $tabs = array( 210 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 211 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 212 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 213 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 214 ); 215 foreach ( $tabs as $tab_id => $tab ) { 216 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 217 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 218 } 219 ?> 220 </h2><?php 208 209 network_edit_site_tabs( array( 'blog_id' => $id ) ); 221 210 222 211 if ( isset($_GET['update']) ) : 223 212 switch($_GET['update']) {