This commit is contained in:
root@pico committed 2015-05-01 21:20:47 +02:00
1 parent 70d2335bba
commit 7428b67da5
1086 files changed
+94145 -59082

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ do_action( 'wpmuadminedit' );
/**
* Fires the requested handler action.
*
* The dynamic portion of the hook name, $_GET['action'], refers to the name
* The dynamic portion of the hook name, `$_GET['action']`, refers to the name
* of the requested action.
*
* @since 3.1.0
+2 -2
View File
@@ -17,7 +17,7 @@ if ( !is_multisite() )
wp_die( __( 'Multisite support is not enabled.' ) );
if ( ! current_user_can( 'manage_network' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$title = __( 'Dashboard' );
$parent_file = 'index.php';
@@ -50,7 +50,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin" target="_blank">Documentation on the Network Admin</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin" target="_blank">Documentation on the Network Admin</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
+2 -2
View File
@@ -23,7 +23,7 @@ $submenu['users.php'][10] = array( _x('Add New', 'user'), 'create_users', 'user
$update_data = wp_get_update_data();
if ( $update_data['counts']['themes'] ) {
if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) {
$menu[15] = array(sprintf( __( 'Themes %s' ), "<span class='update-plugins count-{$update_data['counts']['themes']}'><span class='theme-count'>" . number_format_i18n( $update_data['counts']['themes'] ) . "</span></span>" ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
} else {
$menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
@@ -32,7 +32,7 @@ $submenu['themes.php'][5] = array( __('Installed Themes'), 'manage_network_them
$submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'install_themes', 'theme-install.php' );
$submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' );
if ( current_user_can( 'update_plugins' ) ) {
if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) {
$menu[20] = array( sprintf( __( 'Plugins %s' ), "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n( $update_data['counts']['plugins'] ) . "</span></span>" ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins');
} else {
$menu[20] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
+96 -38
View File
@@ -10,15 +10,41 @@
/** Load WordPress Administration Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );
/** WordPress Translation Install API */
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
if ( ! is_multisite() )
wp_die( __( 'Multisite support is not enabled.' ) );
if ( ! current_user_can( 'manage_network_options' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$title = __( 'Network Settings' );
$parent_file = 'settings.php';
/**
* Print JavaScript in the header on the Network Settings screen.
*
* @since 4.1.0
*/
function network_settings_add_js() {
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
var languageSelect = $( '#WPLANG' );
$( 'form' ).submit( function() {
// Don't show a spinner for English and installed languages,
// as there is nothing to download.
if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
$( '#submit', this ).after( '<span class="spinner language-install-spinner" />' );
}
});
});
</script>
<?php
}
add_action( 'admin_head', 'network_settings_add_js' );
get_current_screen()->add_help_tab( array(
'id' => 'overview',
'title' => __('Overview'),
@@ -28,13 +54,14 @@ get_current_screen()->add_help_tab( array(
'<p>' . __('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.') . '</p>' .
'<p>' . __('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what&#8127;s put in the first post, page, comment, comment author, and comment URL.') . '</p>' .
'<p>' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '</p>' .
'<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' .
'<p>' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '</p>' .
'<p>' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Network Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '</p>'
) );
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -58,6 +85,14 @@ if ( $_POST ) {
'illegal_names', 'limited_email_domains', 'banned_email_domains', 'WPLANG', 'admin_email',
);
// Handle translation install.
if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { // @todo: Skip if already installed
$language = wp_download_language_pack( $_POST['WPLANG'] );
if ( $language ) {
$_POST['WPLANG'] = $language;
}
}
foreach ( $options as $option_name ) {
if ( ! isset($_POST[$option_name]) )
continue;
@@ -79,7 +114,7 @@ if ( $_POST ) {
include( ABSPATH . 'wp-admin/admin-header.php' );
if ( isset( $_GET['updated'] ) ) {
?><div id="message" class="updated"><p><?php _e( 'Options saved.' ) ?></p></div><?php
?><div id="message" class="updated notice is-dismissible"><p><?php _e( 'Options saved.' ) ?></p></div><?php
}
?>
@@ -99,8 +134,8 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th>
<td>
<input name="admin_email" type="email" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option( 'admin_email' ) ) ?>" />
<p class="description">
<input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-desc" class="regular-text" value="<?php echo esc_attr( get_site_option( 'admin_email' ) ) ?>" />
<p class="description" id="admin-email-desc">
<?php _e( 'This email address will receive notifications. Registration and support emails will also come from this address.' ); ?>
</p>
</td>
@@ -116,15 +151,16 @@ if ( isset( $_GET['updated'] ) ) {
$reg = get_site_option( 'registration' );
?>
<td>
<fieldset>
<legend class="screen-reader-text"><?php _e( 'New registrations settings' ) ?></legend>
<label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br />
<label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br />
<label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br />
<label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label>
<p class="description">
<?php if ( is_subdomain_install() )
_e( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' );
?>
</p>
<?php if ( is_subdomain_install() ) {
echo '<p class="description">' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' ) . '</p>';
} ?>
</fieldset>
</td>
</tr>
@@ -149,8 +185,8 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th>
<td>
<input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
<p class="description">
<input name="illegal_names" type="text" id="illegal_names" aria-describedby="illegal-names-desc" class="large-text" value="<?php echo esc_attr( implode( " ", (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
<p class="description" id="illegal-names-desc">
<?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?>
</p>
</td>
@@ -161,9 +197,9 @@ if ( isset( $_GET['updated'] ) ) {
<td>
<?php $limited_email_domains = get_site_option( 'limited_email_domains' );
$limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?>
<textarea name="limited_email_domains" id="limited_email_domains" cols="45" rows="5">
<textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5">
<?php echo esc_textarea( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
<p class="description">
<p class="description" id="limited-email-domains-desc">
<?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?>
</p>
</td>
@@ -172,9 +208,9 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th>
<td>
<textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5">
<textarea name="banned_email_domains" id="banned_email_domains" aria-describedby="banned-email-domains-desc" cols="45" rows="5">
<?php echo esc_textarea( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea>
<p class="description">
<p class="description" id="banned-email-domains-desc">
<?php _e( 'If you want to ban domains from site registrations. One domain per line.' ) ?>
</p>
</td>
@@ -187,9 +223,9 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
<td>
<textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text">
<textarea name="welcome_email" id="welcome_email" aria-describedby="welcome-email-desc" rows="5" cols="45" class="large-text">
<?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea>
<p class="description">
<p class="description" id="welcome-email-desc">
<?php _e( 'The welcome email sent to new site owners.' ) ?>
</p>
</td>
@@ -197,9 +233,9 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th>
<td>
<textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text">
<textarea name="welcome_user_email" id="welcome_user_email" aria-describedby="welcome-user-email-desc" rows="5" cols="45" class="large-text">
<?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea>
<p class="description">
<p class="description" id="welcome-user-email-desc">
<?php _e( 'The welcome email sent to new users.' ) ?>
</p>
</td>
@@ -207,9 +243,9 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th>
<td>
<textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text">
<textarea name="first_post" id="first_post" aria-describedby="first-post-desc" rows="5" cols="45" class="large-text">
<?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea>
<p class="description">
<p class="description" id="first-post-desc">
<?php _e( 'The first post on a new site.' ) ?>
</p>
</td>
@@ -217,9 +253,9 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th>
<td>
<textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text">
<textarea name="first_page" id="first_page" aria-describedby="first-page-desc" rows="5" cols="45" class="large-text">
<?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea>
<p class="description">
<p class="description" id="first-page-desc">
<?php _e( 'The first page on a new site.' ) ?>
</p>
</td>
@@ -227,9 +263,9 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th>
<td>
<textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text">
<textarea name="first_comment" id="first_comment" aria-describedby="first-comment-desc" rows="5" cols="45" class="large-text">
<?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea>
<p class="description">
<p class="description" id="first-comment-desc">
<?php _e( 'The first comment on a new site.' ) ?>
</p>
</td>
@@ -237,8 +273,8 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
<td>
<input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
<p class="description">
<input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo get_site_option('first_comment_author') ?>" />
<p class="description" id="first-comment-author-desc">
<?php _e( 'The author of the first comment on a new site.' ) ?>
</p>
</td>
@@ -246,8 +282,8 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th>
<td>
<input type="text" size="40" name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
<p class="description">
<input type="text" size="40" name="first_comment_url" id="first_comment_url" aria-describedby="first-comment-url-desc" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
<p class="description" id="first-comment-url-desc">
<?php _e( 'The URL for the first comment on a new site.' ) ?>
</p>
</td>
@@ -258,24 +294,38 @@ if ( isset( $_GET['updated'] ) ) {
<tr>
<th scope="row"><?php _e( 'Site upload space' ) ?></th>
<td>
<label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br />
<label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" aria-describedby="blog-upload-space-desc" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br />
<p class="screen-reader-text" id="blog-upload-space-desc">
<?php _e( 'Size in megabytes' ) ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th>
<td><input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option('upload_filetypes', 'jpg jpeg png gif') ) ?>" size="45" /></td>
<td>
<input name="upload_filetypes" type="text" id="upload_filetypes" aria-describedby="upload-filetypes-desc" class="large-text" value="<?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ) ?>" size="45" />
<p class="description" id="upload-filetypes-desc">
<?php _e( 'Allowed file types. Separate types by spaces.' ) ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th>
<td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?></td>
<td>
<?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" aria-describedby="fileupload-maxk-desc" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?>
<p class="screen-reader-text" id="fileupload-maxk-desc">
<?php _e( 'Size in kilobytes' ) ?>
</p>
</td>
</tr>
</table>
<?php
$languages = get_available_languages();
if ( ! empty( $languages ) ) {
$translations = wp_get_available_translations();
if ( ! empty( $languages ) || ! empty( $translations ) ) {
?>
<h3><?php _e( 'Language Settings' ); ?></h3>
<table class="form-table">
@@ -289,10 +339,12 @@ if ( isset( $_GET['updated'] ) ) {
}
wp_dropdown_languages( array(
'name' => 'WPLANG',
'id' => 'WPLANG',
'selected' => $lang,
'languages' => $languages,
'name' => 'WPLANG',
'id' => 'WPLANG',
'selected' => $lang,
'languages' => $languages,
'translations' => $translations,
'show_available_translations' => wp_can_install_language_pack(),
) );
?>
</td>
@@ -325,9 +377,15 @@ if ( isset( $_GET['updated'] ) ) {
* @param array $admin_menus The menu items available.
*/
$menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) );
$fieldset_end = '';
if ( count( (array) $menu_items ) > 1 ) {
echo '<fieldset><legend class="screen-reader-text">' . __( 'Enable menus' ) . '</legend>';
$fieldset_end = '</fieldset>';
}
foreach ( (array) $menu_items as $key => $val ) {
echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";
}
echo $fieldset_end;
?>
</td>
</tr>
+32 -23
View File
@@ -29,7 +29,7 @@ if ( ! current_user_can( 'manage_sites' ) )
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -40,7 +40,7 @@ if ( ! $id )
$details = get_blog_details( $id );
if ( !can_edit_network( $details->site_id ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$parsed = parse_url( $details->siteurl );
$is_main_site = is_main_site( $id );
@@ -50,15 +50,6 @@ if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
switch_to_blog( $id );
if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
$blog_address = esc_url_raw( $_POST['blog']['domain'] . $_POST['blog']['path'] );
if ( get_option( 'siteurl' ) != $blog_address )
update_option( 'siteurl', $blog_address );
if ( get_option( 'home' ) != $blog_address )
update_option( 'home', $blog_address );
}
// Rewrite rules can't be flushed during switch to blog.
delete_option( 'rewrite_rules' );
@@ -74,6 +65,17 @@ if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
}
update_blog_details( $id, $blog_data );
if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
$new_details = get_blog_details( $id, false );
$blog_address = esc_url_raw( $new_details->domain . $new_details->path );
if ( get_option( 'siteurl' ) != $blog_address ) {
update_option( 'siteurl', $blog_address );
}
if ( get_option( 'home' ) != $blog_address ) {
update_option( 'home', $blog_address );
}
}
restore_current_blog();
wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') );
exit;
@@ -86,8 +88,8 @@ if ( isset($_GET['update']) ) {
}
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
$title = sprintf( __('Edit Site: %s'), $site_url_no_http );
$title_site_url_linked = sprintf( __( 'Edit Site: %s' ), '<a href="' . get_blogaddress_by_id( $id ) . '">' . $site_url_no_http . '</a>' );
$title = sprintf( __( 'Edit Site: %s' ), $site_url_no_http );
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
@@ -115,41 +117,45 @@ foreach ( $tabs as $tab_id => $tab ) {
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg )
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
} ?>
<form method="post" action="site-info.php?action=update-site">
<?php wp_nonce_field( 'edit-site' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Domain' ) ?></th>
<?php if ( $is_main_site ) { ?>
<th scope="row"><?php _e( 'Domain' ) ?></th>
<td><code><?php echo $parsed['scheme'] . '://' . esc_attr( $details->domain ) ?></code></td>
<?php } else { ?>
<td><?php echo $parsed['scheme'] . '://'; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
<th scope="row"><label for="domain"><?php _e( 'Domain' ) ?></label></th>
<td><?php echo $parsed['scheme'] . '://'; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" /></td>
<?php } ?>
</tr>
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Path' ) ?></th>
<?php if ( $is_main_site ) { ?>
<th scope="row"><?php _e( 'Path' ) ?></th>
<td><code><?php echo esc_attr( $details->path ) ?></code></td>
<?php
} else {
switch_to_blog( $id );
?>
<td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style="margin-bottom:5px;" />
<br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php if ( get_option( 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_option( 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td>
<th scope="row"><label for="path"><?php _e( 'Path' ) ?></label></th>
<td>
<input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" /><br />
<input type="checkbox" name="update_home_url" id="update_home_url" value="update" <?php if ( get_option( 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_option( 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <label for="update_home_url"><?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></label>
</td>
<?php
restore_current_blog();
} ?>
</tr>
<tr class="form-field">
<th scope="row"><?php _ex( 'Registered', 'site' ) ?></th>
<td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td>
<th scope="row"><label for="blog_registered"><?php _ex( 'Registered', 'site' ) ?></label></th>
<td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" /></td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Last Updated' ); ?></th>
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" size="40" /></td>
<th scope="row"><label for="blog_last_updated"><?php _e( 'Last Updated' ); ?></label></th>
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" /></td>
</tr>
<?php
$attribute_fields = array( 'public' => __( 'Public' ) );
@@ -163,10 +169,13 @@ if ( ! empty( $messages ) ) {
<tr>
<th scope="row"><?php _e( 'Attributes' ); ?></th>
<td>
<fieldset>
<legend class="screen-reader-text"><?php _e( 'Set site attributes' ) ?></legend>
<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> />
<?php echo $field_label; ?></label><br/>
<?php endforeach; ?>
<fieldset>
</td>
</tr>
</table>
+35 -18
View File
@@ -26,7 +26,7 @@ if ( ! current_user_can( 'manage_sites' ) )
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -49,15 +49,19 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) );
}
$email = sanitize_email( $blog['email'] );
$title = $blog['title'];
if ( empty( $domain ) )
wp_die( __( 'Missing or invalid site address.' ) );
if ( empty( $email ) )
if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) {
wp_die( __( 'Missing email address.' ) );
if ( !is_email( $email ) )
}
$email = sanitize_email( $blog['email'] );
if ( ! is_email( $email ) ) {
wp_die( __( 'Invalid email address.' ) );
}
if ( is_subdomain_install() ) {
$newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
@@ -81,13 +85,21 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
$wpdb->hide_errors();
$id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
$wpdb->show_errors();
if ( !is_wp_error( $id ) ) {
if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) )
if ( ! is_wp_error( $id ) ) {
if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) {
update_user_option( $user_id, 'primary_blog', $id, true );
$content_mail = sprintf( __( 'New site created by %1$s
}
$content_mail = sprintf(
/* translators: 1: user login, 2: site url, 3: site name/title */
__( 'New site created by %1$s
Address: %2$s
Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $title ) );
Name: %3$s' ),
$current_user->user_login,
get_site_url( $id ),
wp_unslash( $title )
);
wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) );
@@ -100,7 +112,12 @@ Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $tit
if ( isset($_GET['update']) ) {
$messages = array();
if ( 'added' == $_GET['update'] )
$messages[] = sprintf( __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), esc_url( get_admin_url( absint( $_GET['id'] ) ) ), network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) );
$messages[] = sprintf(
/* translators: 1: dashboard url, 2: network admin edit url */
__( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ),
esc_url( get_admin_url( absint( $_GET['id'] ) ) ),
network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) )
);
}
$title = __('Add New Site');
@@ -117,30 +134,30 @@ require( ABSPATH . 'wp-admin/admin-header.php' );
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg )
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
} ?>
<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate">
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?>
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Site Address' ) ?></th>
<th scope="row"><label for="site-address"><?php _e( 'Site Address' ) ?></label></th>
<td>
<?php if ( is_subdomain_install() ) { ?>
<input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span>
<input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" /><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span>
<?php } else {
echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/>
echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" />
<?php }
echo '<p>' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>';
echo '<p id="site-address-desc">' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>';
?>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Site Title' ) ?></th>
<td><input name="blog[title]" type="text" class="regular-text" title="<?php esc_attr_e( 'Title' ) ?>"/></td>
<th scope="row"><label for="site-title"><?php _e( 'Site Title' ) ?></label></th>
<td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td>
</tr>
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Admin Email' ) ?></th>
<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" data-autocomplete-type="search" data-autocomplete-field="user_email" title="<?php esc_attr_e( 'Email' ) ?>"/></td>
<th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ) ?></label></td>
<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" /></td>
</tr>
<tr class="form-field">
<td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td>
+7 -7
View File
@@ -29,7 +29,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -40,7 +40,7 @@ if ( ! $id )
$details = get_blog_details( $id );
if ( !can_edit_network( $details->site_id ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$is_main_site = is_main_site( $id );
@@ -76,8 +76,8 @@ if ( isset($_GET['update']) ) {
}
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
$title = sprintf( __('Edit Site: %s'), $site_url_no_http );
$title_site_url_linked = sprintf( __( 'Edit Site: %s' ), '<a href="' . get_blogaddress_by_id( $id ) . '">' . $site_url_no_http . '</a>' );
$title = sprintf( __( 'Edit Site: %s' ), $site_url_no_http );
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
@@ -105,7 +105,7 @@ foreach ( $tabs as $tab_id => $tab ) {
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg )
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
} ?>
<form method="post" action="site-settings.php?action=update-site">
<?php wp_nonce_field( 'edit-site' ); ?>
@@ -138,14 +138,14 @@ if ( ! empty( $messages ) ) {
if ( strpos( $option->option_value, "\n" ) !== false ) {
?>
<tr class="form-field">
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ) ?>"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></label></th>
<td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php echo esc_textarea( $option->option_value ) ?></textarea></td>
</tr>
<?php
} else {
?>
<tr class="form-field">
<th scope="row"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th>
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ) ?>"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></label></th>
<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
<td><code><?php echo esc_html( $option->option_value ) ?></code></td>
<?php } else { ?>
+21 -11
View File
@@ -29,7 +29,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -57,7 +57,7 @@ $wp_list_table->prepare_items();
$details = get_blog_details( $id );
if ( !can_edit_network( $details->site_id ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$is_main_site = is_main_site( $id );
@@ -127,11 +127,11 @@ if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
}
add_thickbox();
add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) );
add_screen_option( 'per_page' );
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
$title = sprintf( __('Edit Site: %s'), $site_url_no_http );
$title_site_url_linked = sprintf( __( 'Edit Site: %s' ), '<a href="' . get_blogaddress_by_id( $id ) . '">' . $site_url_no_http . '</a>' );
$title = sprintf( __( 'Edit Site: %s' ), $site_url_no_http );
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
@@ -156,18 +156,28 @@ foreach ( $tabs as $tab_id => $tab ) {
</h3><?php
if ( isset( $_GET['enabled'] ) ) {
$_GET['enabled'] = absint( $_GET['enabled'] );
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
$enabled = absint( $_GET['enabled'] );
if ( 1 == $enabled ) {
$message = __( 'Theme enabled.' );
} else {
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
} elseif ( isset( $_GET['disabled'] ) ) {
$_GET['disabled'] = absint( $_GET['disabled'] );
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
$disabled = absint( $_GET['disabled'] );
if ( 1 == $disabled ) {
$message = __( 'Theme disabled.' );
} else {
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
} ?>
<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
<form method="get" action="">
<form method="get">
<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
</form>
+26 -28
View File
@@ -32,7 +32,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -50,7 +50,7 @@ if ( ! $id )
$details = get_blog_details( $id );
if ( ! can_edit_network( $details->site_id ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$is_main_site = is_main_site( $id );
@@ -133,7 +133,7 @@ if ( $action ) {
// If the user doesn't already belong to the blog, bail.
if ( !is_user_member_of_blog( $user_id ) )
wp_die(__('Cheatin&#8217; uh?'));
wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
$user = get_userdata( $user_id );
$user->set_role( $_REQUEST['new_role'] );
@@ -155,11 +155,11 @@ if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
exit();
}
add_screen_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) );
add_screen_option( 'per_page' );
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
$title = sprintf( __('Edit Site: %s'), $site_url_no_http );
$title_site_url_linked = sprintf( __( 'Edit Site: %s' ), '<a href="' . get_blogaddress_by_id( $id ) . '">' . $site_url_no_http . '</a>' );
$title = sprintf( __( 'Edit Site: %s' ), $site_url_no_http );
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
@@ -177,9 +177,7 @@ if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users
require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
<script type="text/javascript">
/* <![CDATA[ */
var current_site_id = <?php echo $id; ?>;
/* ]]> */
</script>
@@ -203,39 +201,39 @@ foreach ( $tabs as $tab_id => $tab ) {
if ( isset($_GET['update']) ) :
switch($_GET['update']) {
case 'adduser':
echo '<div id="message" class="updated"><p>' . __( 'User added.' ) . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
break;
case 'err_add_member':
echo '<div id="message" class="error"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
break;
case 'err_add_notfound':
echo '<div id="message" class="error"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
break;
case 'promote':
echo '<div id="message" class="updated"><p>' . __( 'Changed roles.' ) . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
break;
case 'err_promote':
echo '<div id="message" class="error"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
break;
case 'remove':
echo '<div id="message" class="updated"><p>' . __( 'User removed from this site.' ) . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
break;
case 'err_remove':
echo '<div id="message" class="error"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
break;
case 'newuser':
echo '<div id="message" class="updated"><p>' . __( 'User created.' ) . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
break;
case 'err_new':
echo '<div id="message" class="error"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
break;
case 'err_new_dup':
echo '<div id="message" class="error"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
break;
}
endif; ?>
<form class="search-form" action="" method="get">
<form class="search-form" method="get">
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
</form>
@@ -264,12 +262,12 @@ if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_us
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
<table class="form-table">
<tr>
<th scope="row"><?php _e( 'Username' ); ?></th>
<th scope="row"><label for="newuser"><?php _e( 'Username' ); ?></label></th>
<td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td>
</tr>
<tr>
<th scope="row"><?php _e( 'Role' ); ?></th>
<td><select name="new_role" id="new_role_0">
<th scope="row"><label for="new_role_adduser"><?php _e( 'Role' ); ?></label></th>
<td><select name="new_role" id="new_role_adduser">
<?php wp_dropdown_roles( get_option( 'default_role' ) ); ?>
</select></td>
</tr>
@@ -293,16 +291,16 @@ if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_use
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
<table class="form-table">
<tr>
<th scope="row"><?php _e( 'Username' ) ?></th>
<td><input type="text" class="regular-text" name="user[username]" /></td>
<th scope="row"><label for="user_username"><?php _e( 'Username' ) ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="user_username" /></td>
</tr>
<tr>
<th scope="row"><?php _e( 'Email' ) ?></th>
<td><input type="text" class="regular-text" name="user[email]" /></td>
<th scope="row"><label for="user_email"><?php _e( 'Email' ) ?></label></th>
<td><input type="text" class="regular-text" name="user[email]" id="user_email" /></td>
</tr>
<tr>
<th scope="row"><?php _e( 'Role' ); ?></th>
<td><select name="new_role" id="new_role_0">
<th scope="row"><label for="new_role_newuser"><?php _e( 'Role' ); ?></label></th>
<td><select name="new_role" id="new_role_newuser">
<?php wp_dropdown_roles( get_option( 'default_role' ) ); ?>
</select></td>
</tr>
+8 -8
View File
@@ -14,7 +14,7 @@ if ( ! is_multisite() )
wp_die( __( 'Multisite support is not enabled.' ) );
if ( ! current_user_can( 'manage_sites' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
$pagenum = $wp_list_table->get_pagenum();
@@ -22,7 +22,7 @@ $pagenum = $wp_list_table->get_pagenum();
$title = __( 'Sites' );
$parent_file = 'sites.php';
add_screen_option( 'per_page', array( 'label' => _x( 'Sites', 'sites per page (screen options)' ) ) );
add_screen_option( 'per_page' );
get_current_screen()->add_help_tab( array(
'id' => 'overview',
@@ -42,7 +42,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -97,7 +97,7 @@ if ( isset( $_GET['action'] ) ) {
case 'deleteblog':
if ( ! current_user_can( 'delete_sites' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
$updated_action = 'not_deleted';
if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
@@ -227,8 +227,8 @@ if ( isset( $_GET['updated'] ) ) {
/**
* Filter a specific, non-default site-updated message in the Network admin.
*
* The dynamic portion of the hook name, $_GET['updated'], refers to the non-default
* site update action.
* The dynamic portion of the hook name, `$_GET['updated']`, refers to the
* non-default site update action.
*
* @since 3.1.0
*
@@ -239,7 +239,7 @@ if ( isset( $_GET['updated'] ) ) {
}
if ( ! empty( $msg ) )
$msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>';
$msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>';
}
$wp_list_table->prepare_items();
@@ -261,7 +261,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<?php echo $msg; ?>
<form action="" method="get" id="ms-search">
<form method="get" id="ms-search">
<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?>
<input type="hidden" name="action" value="blogs" />
</form>
+92 -35
View File
@@ -96,30 +96,49 @@ if ( $action ) {
require_once(ABSPATH . 'wp-admin/admin-footer.php');
exit;
case 'delete-selected':
if ( ! current_user_can( 'delete_themes' ) )
if ( ! current_user_can( 'delete_themes' ) ) {
wp_die( __('You do not have sufficient permissions to delete themes for this site.') );
}
check_admin_referer( 'bulk-themes' );
$themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
unset( $themes[ get_option( 'stylesheet' ) ], $themes[ get_option( 'template' ) ] );
if ( empty( $themes ) ) {
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
exit;
}
$files_to_delete = $theme_info = array();
foreach ( $themes as $key => $theme ) {
$theme_info[ $theme ] = wp_get_theme( $theme );
$files_to_delete = array_merge( $files_to_delete, list_files( $theme_info[ $theme ]->get_stylesheet_directory() ) );
}
$themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) );
if ( empty( $themes ) ) {
wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) );
exit;
}
$files_to_delete = $theme_info = array();
$theme_translations = wp_get_installed_translations( 'themes' );
foreach ( $themes as $key => $theme ) {
$theme_info[ $theme ] = wp_get_theme( $theme );
// Locate all the files in that folder.
$files = list_files( $theme_info[ $theme ]->get_stylesheet_directory() );
if ( $files ) {
$files_to_delete = array_merge( $files_to_delete, $files );
}
// Add translation files.
$theme_slug = $theme_info[ $theme ]->get_stylesheet();
if ( ! empty( $theme_translations[ $theme_slug ] ) ) {
$translations = $theme_translations[ $theme_slug ];
foreach ( $translations as $translation => $data ) {
$files_to_delete[] = $theme_slug . '-' . $translation . '.po';
$files_to_delete[] = $theme_slug . '-' . $translation . '.mo';
}
}
}
include(ABSPATH . 'wp-admin/update.php');
$parent_file = 'themes.php';
@@ -127,30 +146,52 @@ if ( $action ) {
if ( ! isset( $_REQUEST['verify-delete'] ) ) {
wp_enqueue_script( 'jquery' );
require_once( ABSPATH . 'wp-admin/admin-header.php' );
$themes_to_delete = count( $themes );
?>
<div class="wrap">
<?php
$themes_to_delete = count( $themes );
echo '<h2>' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . '</h2>';
?>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This theme may be active on other sites in the network.', 'These themes may be active on other sites in the network.', $themes_to_delete ); ?></p></div>
<p><?php echo _n( 'You are about to remove the following theme:', 'You are about to remove the following themes:', $themes_to_delete ); ?></p>
<?php if ( 1 == $themes_to_delete ) : ?>
<h2><?php _e( 'Delete Theme' ); ?></h2>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div>
<p><?php _e( 'You are about to remove the following theme:' ); ?></p>
<?php else : ?>
<h2><?php _e( 'Delete Themes' ); ?></h2>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div>
<p><?php _e( 'You are about to remove the following themes:' ); ?></p>
<?php endif; ?>
<ul class="ul-disc">
<?php foreach ( $theme_info as $theme )
echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $theme->display('Name'), $theme->display('Author') ), '</li>'; /* translators: 1: theme name, 2: theme author */ ?>
<?php
foreach ( $theme_info as $theme ) {
/* translators: 1: theme name, 2: theme author */
echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $theme->display('Name'), $theme->display('Author') ), '</li>';
}
?>
</ul>
<p><?php _e('Are you sure you wish to delete these themes?'); ?></p>
<?php if ( 1 == $themes_to_delete ) : ?>
<p><?php _e( 'Are you sure you wish to delete this theme?' ); ?></p>
<?php else : ?>
<p><?php _e( 'Are you sure you wish to delete these themes?' ); ?></p>
<?php endif; ?>
<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
<input type="hidden" name="verify-delete" value="1" />
<input type="hidden" name="action" value="delete-selected" />
<?php
foreach ( (array) $themes as $theme )
foreach ( (array) $themes as $theme ) {
echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />';
}
wp_nonce_field( 'bulk-themes' );
if ( 1 == $themes_to_delete ) {
submit_button( __( 'Yes, Delete this theme' ), 'button', 'submit', false );
} else {
submit_button( __( 'Yes, Delete these themes' ), 'button', 'submit', false );
}
?>
<?php wp_nonce_field('bulk-themes') ?>
<?php submit_button( _n( 'Yes, Delete this theme', 'Yes, Delete these themes', $themes_to_delete ), 'button', 'submit', false ); ?>
</form>
<form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
<?php
$referer = wp_get_referer();
?>
<form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;">
<?php submit_button( __( 'No, Return me to the theme list' ), 'button', 'submit', false ); ?>
</form>
@@ -158,8 +199,9 @@ if ( $action ) {
<div id="files-list" style="display:none;">
<ul class="code">
<?php
foreach ( (array) $files_to_delete as $file )
echo '<li>' . esc_html( str_replace( WP_CONTENT_DIR . "/themes", '', $file) ) . '</li>';
foreach ( (array) $files_to_delete as $file ) {
echo '<li>' . esc_html( str_replace( WP_CONTENT_DIR . '/themes', '', $file ) ) . '</li>';
}
?>
</ul>
</div>
@@ -192,7 +234,7 @@ $wp_list_table->prepare_items();
add_thickbox();
add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
add_screen_option( 'per_page' );
get_current_screen()->add_help_tab( array(
'id' => 'overview',
@@ -205,7 +247,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -226,23 +268,38 @@ if ( $s )
<?php
if ( isset( $_GET['enabled'] ) ) {
$_GET['enabled'] = absint( $_GET['enabled'] );
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
$enabled = absint( $_GET['enabled'] );
if ( 1 == $enabled ) {
$message = __( 'Theme enabled.' );
} else {
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
} elseif ( isset( $_GET['disabled'] ) ) {
$_GET['disabled'] = absint( $_GET['disabled'] );
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
$disabled = absint( $_GET['disabled'] );
if ( 1 == $disabled ) {
$message = __( 'Theme disabled.' );
} else {
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
} elseif ( isset( $_GET['deleted'] ) ) {
$_GET['deleted'] = absint( $_GET['deleted'] );
echo '<div id="message" class="updated"><p>' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '</p></div>';
$deleted = absint( $_GET['deleted'] );
if ( 1 == $deleted ) {
$message = __( 'Theme deleted.' );
} else {
$message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) {
echo '<div class="error"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
}
?>
<form method="get" action="">
<form method="get">
<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
</form>
@@ -253,7 +310,7 @@ if ( 'broken' == $status )
echo '<p class="clear">' . __('The following themes are installed but incomplete. Themes must have a stylesheet and a template.') . '</p>';
?>
<form method="post" action="">
<form method="post">
<input type="hidden" name="theme_status" value="<?php echo esc_attr($status) ?>" />
<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
+14 -5
View File
@@ -29,14 +29,14 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
require_once( ABSPATH . 'wp-admin/admin-header.php' );
if ( ! current_user_can( 'manage_network' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
echo '<div class="wrap">';
echo '<h2>' . __( 'Upgrade Network' ) . '</h2>';
@@ -52,7 +52,7 @@ switch ( $action ) {
update_site_option( 'wpmu_upgrade_site', $wp_db_version );
}
$blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
if ( empty( $blogs ) ) {
echo '<p>' . __( 'All done!' ) . '</p>';
break;
@@ -63,10 +63,19 @@ switch ( $action ) {
$siteurl = site_url();
$upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
restore_current_blog();
echo "<li>$siteurl</li>";
$response = wp_remote_get( $upgrade_url, array( 'timeout' => 120, 'httpversion' => '1.1' ) );
if ( is_wp_error( $response ) )
wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: <em>%2$s</em>' ), $siteurl, $response->get_error_message() ) );
if ( is_wp_error( $response ) ) {
wp_die( sprintf(
/* translators: 1: site url, 2: server error message */
__( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ),
$siteurl,
'<em>' . $response->get_error_message() . '</em>'
) );
}
/**
* Fires after the Multisite DB upgrade for each site is complete.
*
+10 -9
View File
@@ -26,26 +26,27 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) {
check_admin_referer( 'add-user', '_wpnonce_add-user' );
if ( ! current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
if ( ! is_array( $_POST['user'] ) )
wp_die( __( 'Cannot create an empty user.' ) );
$user = $_POST['user'];
$user = wp_unslash( $_POST['user'] );
$user_details = wpmu_validate_user_signup( $user['username'], $user['email'] );
if ( is_wp_error( $user_details[ 'errors' ] ) && ! empty( $user_details[ 'errors' ]->errors ) ) {
$add_user_errors = $user_details[ 'errors' ];
} else {
$password = wp_generate_password( 12, false);
$user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
$user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, sanitize_email( $user['email'] ) );
if ( ! $user_id ) {
$add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
@@ -73,7 +74,7 @@ require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg )
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
}
if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?>
@@ -87,12 +88,12 @@ if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?>
<form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post">
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Username' ) ?></th>
<td><input type="text" class="regular-text" name="user[username]" /></td>
<th scope="row"><label for="username"><?php _e( 'Username' ) ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="username" /></td>
</tr>
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Email' ) ?></th>
<td><input type="text" class="regular-text" name="user[email]" /></td>
<th scope="row"><label for="email"><?php _e( 'Email' ) ?></label></th>
<td><input type="text" class="regular-text" name="user[email]" id="email"/></td>
</tr>
<tr class="form-field">
<td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
+75 -42
View File
@@ -14,51 +14,70 @@ if ( ! is_multisite() )
wp_die( __( 'Multisite support is not enabled.' ) );
if ( ! current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
function confirm_delete_users( $users ) {
$current_user = wp_get_current_user();
if ( !is_array( $users ) )
if ( ! is_array( $users ) || empty( $users ) ) {
return false;
}
?>
<h2><?php esc_html_e( 'Users' ); ?></h2>
<p><?php _e( 'Transfer or delete content before deleting users.' ); ?></p>
<?php if ( 1 == count( $users ) ) : ?>
<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
<?php else : ?>
<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
<?php endif; ?>
<form action="users.php?action=dodelete" method="post">
<input type="hidden" name="dodelete" />
<?php
wp_nonce_field( 'ms-users-delete' );
$site_admins = get_super_admins();
$admin_out = '<option value="' . $current_user->ID . '">' . $current_user->user_login . '</option>';
$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>'; ?>
<table class="form-table">
<?php foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
if ( $user_id != '' && $user_id != '0' ) {
$delete_user = get_userdata( $user_id );
foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
if ( $val != '' && $val != '0' ) {
$delete_user = get_userdata( $val );
if ( ! current_user_can( 'delete_user', $delete_user->ID ) )
if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) );
}
if ( in_array( $delete_user->user_login, $site_admins ) )
wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), $delete_user->user_login ) );
if ( in_array( $delete_user->user_login, $site_admins ) ) {
wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), '<em>' . $delete_user->user_login . '</em>' ) );
}
?>
<tr>
<th scope="row"><?php echo $delete_user->user_login; ?>
<?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
</th>
<?php $blogs = get_blogs_of_user( $user_id, true );
echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
$blogs = get_blogs_of_user( $val, true );
if ( !empty( $blogs ) ) {
if ( ! empty( $blogs ) ) {
?>
<br /><fieldset><p><legend><?php printf( __( "What should be done with content owned by %s?" ), '<em>' . $delete_user->user_login . '</em>' ); ?></legend></p>
<td><fieldset><p><legend><?php printf(
/* translators: user login */
__( 'What should be done with content owned by %s?' ),
'<em>' . $delete_user->user_login . '</em>'
); ?></legend></p>
<?php
foreach ( (array) $blogs as $key => $details ) {
$blog_users = get_users( array( 'blog_id' => $details->userblog_id, 'fields' => array( 'ID', 'user_login' ) ) );
if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
$user_dropdown = "<select name='blog[$val][{$key}]'>";
$user_dropdown = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
$user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
$user_list = '';
foreach ( $blog_users as $user ) {
if ( ! in_array( $user->ID, $allusers ) )
if ( ! in_array( $user->ID, $allusers ) ) {
$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
}
}
if ( '' == $user_list )
if ( '' == $user_list ) {
$user_list = $admin_out;
}
$user_dropdown .= $user_list;
$user_dropdown .= "</select>\n";
?>
@@ -67,23 +86,37 @@ function confirm_delete_users( $users ) {
<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
<?php _e( 'Delete all content.' ); ?></label></li>
<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
<?php echo __( 'Attribute all content to:' ) . '</label>' . $user_dropdown; ?></li>
<?php echo __( 'Attribute all content to:' ) . "</label>\n" . $user_dropdown; ?></li>
</ul>
<?php
}
}
echo "</fieldset>";
}
echo "</fieldset></td></tr>";
} else {
?>
<td><fieldset><p><legend><?php _e( 'User has no sites or content and will be deleted.' ); ?></legend></p>
<?php } ?>
</tr>
<?php
}
}
?>
</table>
<?php
/** This action is documented in wp-admin/users.php */
do_action( 'delete_user_form', $current_user );
if ( 1 == count( $users ) ) : ?>
<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
<?php else : ?>
<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
<?php endif;
submit_button( __('Confirm Deletion'), 'delete' );
?>
</form>
<?php
<?php
return true;
}
@@ -94,7 +127,7 @@ if ( isset( $_GET['action'] ) ) {
switch ( $_GET['action'] ) {
case 'deleteuser':
if ( ! current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
check_admin_referer( 'deleteuser' );
@@ -107,15 +140,15 @@ if ( isset( $_GET['action'] ) ) {
echo '<div class="wrap">';
confirm_delete_users( $_POST['allusers'] );
echo '</div>';
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
} else {
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
} else {
wp_redirect( network_admin_url( 'users.php' ) );
}
exit();
case 'allusers':
if ( !current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) {
check_admin_referer( 'bulk-users-network' );
@@ -123,12 +156,12 @@ if ( isset( $_GET['action'] ) ) {
$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
$userfunction = '';
foreach ( (array) $_POST['allusers'] as $key => $val ) {
if ( !empty( $val ) ) {
foreach ( (array) $_POST['allusers'] as $user_id ) {
if ( !empty( $user_id ) ) {
switch ( $doaction ) {
case 'delete':
if ( ! current_user_can( 'delete_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
$title = __( 'Users' );
$parent_file = 'users.php';
require_once( ABSPATH . 'wp-admin/admin-header.php' );
@@ -139,26 +172,26 @@ if ( isset( $_GET['action'] ) ) {
exit();
case 'spam':
$user = get_userdata( $val );
$user = get_userdata( $user_id );
if ( is_super_admin( $user->ID ) )
wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );
$userfunction = 'all_spam';
$blogs = get_blogs_of_user( $val, true );
foreach ( (array) $blogs as $key => $details ) {
$blogs = get_blogs_of_user( $user_id, true );
foreach ( (array) $blogs as $details ) {
if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
update_blog_status( $details->userblog_id, 'spam', '1' );
}
update_user_status( $val, 'spam', '1' );
update_user_status( $user_id, 'spam', '1' );
break;
case 'notspam':
$userfunction = 'all_notspam';
$blogs = get_blogs_of_user( $val, true );
foreach ( (array) $blogs as $key => $details )
$blogs = get_blogs_of_user( $user_id, true );
foreach ( (array) $blogs as $details )
update_blog_status( $details->userblog_id, 'spam', '0' );
update_user_status( $val, 'spam', '0' );
update_user_status( $user_id, 'spam', '0' );
break;
}
}
@@ -177,7 +210,7 @@ if ( isset( $_GET['action'] ) ) {
case 'dodelete':
check_admin_referer( 'ms-users-delete' );
if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), 403 );
if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) {
foreach ( $_POST['blog'] as $id => $users ) {
@@ -223,7 +256,7 @@ if ( $pagenum > $total_pages && $total_pages > 0 ) {
$title = __( 'Users' );
$parent_file = 'users.php';
add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
add_screen_option( 'per_page' );
get_current_screen()->add_help_tab( array(
'id' => 'overview',
@@ -239,7 +272,7 @@ get_current_screen()->add_help_tab( array(
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
@@ -247,7 +280,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) {
?>
<div id="message" class="updated"><p>
<div id="message" class="updated notice is-dismissible"><p>
<?php
switch ( $_REQUEST['action'] ) {
case 'delete':
@@ -284,7 +317,7 @@ if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty(
<?php $wp_list_table->views(); ?>
<form action="" method="get" class="search-form">
<form method="get" class="search-form">
<?php $wp_list_table->search_box( __( 'Search Users' ), 'all-user' ); ?>
</form>