wip
This commit is contained in:
@@ -199,8 +199,9 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
</table>
|
||||
<h2><?php _e( 'Registration Settings' ); ?></h2>
|
||||
<table class="form-table" role="presentation">
|
||||
<?php $new_registrations_settings_title = __( 'Allow new registrations' ); ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Allow new registrations' ); ?></th>
|
||||
<th scope="row"><?php echo $new_registrations_settings_title; ?></th>
|
||||
<?php
|
||||
if ( ! get_site_option( 'registration' ) ) {
|
||||
update_site_option( 'registration', 'none' );
|
||||
@@ -209,12 +210,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
?>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<?php
|
||||
/* translators: Hidden accessibility text. */
|
||||
_e( 'New registrations settings' );
|
||||
?>
|
||||
</legend>
|
||||
<legend class="screen-reader-text"><?php echo $new_registrations_settings_title; ?></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 />
|
||||
@@ -510,14 +506,12 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
?>
|
||||
<h2><?php _e( 'Menu Settings' ); ?></h2>
|
||||
<table id="menu" class="form-table">
|
||||
<?php $enable_administration_menus_title = __( 'Enable administration menus' ); ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
|
||||
<th scope="row"><?php echo $enable_administration_menus_title; ?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo '<fieldset><legend class="screen-reader-text">' .
|
||||
/* translators: Hidden accessibility text. */
|
||||
__( 'Enable menus' ) .
|
||||
'</legend>';
|
||||
echo '<fieldset><legend class="screen-reader-text">' . $enable_administration_menus_title . '</legend>';
|
||||
|
||||
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/>';
|
||||
|
||||
@@ -196,24 +196,21 @@ if ( ! empty( $messages ) ) {
|
||||
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ); ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
$site_attributes_title = __( 'Attributes' );
|
||||
|
||||
$attribute_fields = array( 'public' => _x( 'Public', 'site' ) );
|
||||
if ( ! $is_main_site ) {
|
||||
$attribute_fields['archived'] = __( 'Archived' );
|
||||
$attribute_fields['spam'] = _x( 'Spam', 'site' );
|
||||
$attribute_fields['deleted'] = __( 'Deleted' );
|
||||
$attribute_fields['deleted'] = __( 'Flagged for Deletion' );
|
||||
}
|
||||
$attribute_fields['mature'] = __( 'Mature' );
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Attributes' ); ?></th>
|
||||
<th scope="row"><?php echo $site_attributes_title; ?></th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<?php
|
||||
/* translators: Hidden accessibility text. */
|
||||
_e( 'Set site attributes' );
|
||||
?>
|
||||
</legend>
|
||||
<legend class="screen-reader-text"><?php echo $site_attributes_title; ?></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 ); ?> <?php disabled( ! in_array( (int) $details->$field_key, array( 0, 1 ), true ) ); ?> />
|
||||
<?php echo $field_label; ?></label><br />
|
||||
|
||||
@@ -204,7 +204,7 @@ if ( ! empty( $messages ) ) {
|
||||
}
|
||||
?>
|
||||
<p><?php echo wp_required_field_message(); ?></p>
|
||||
<form method="post" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate">
|
||||
<form method="post" enctype="multipart/form-data" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate">
|
||||
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
|
||||
<table class="form-table" role="presentation">
|
||||
<tr class="form-field form-required">
|
||||
|
||||
@@ -121,15 +121,16 @@ if ( ! empty( $messages ) ) {
|
||||
<table class="form-table" role="presentation">
|
||||
<?php
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $id );
|
||||
$sql = "SELECT * FROM {$blog_prefix}options
|
||||
WHERE option_name NOT LIKE %s
|
||||
AND option_name NOT LIKE %s";
|
||||
$query = $wpdb->prepare(
|
||||
$sql,
|
||||
$wpdb->esc_like( '_' ) . '%',
|
||||
'%' . $wpdb->esc_like( 'user_roles' )
|
||||
$options = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
'SELECT * FROM %i
|
||||
WHERE option_name NOT LIKE %s
|
||||
AND option_name NOT LIKE %s',
|
||||
"{$blog_prefix}options",
|
||||
$wpdb->esc_like( '_' ) . '%',
|
||||
'%' . $wpdb->esc_like( 'user_roles' )
|
||||
)
|
||||
);
|
||||
$options = $wpdb->get_results( $query );
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( 'default_role' === $option->option_name ) {
|
||||
|
||||
@@ -139,19 +139,37 @@ if ( $action ) {
|
||||
|
||||
case 'promote':
|
||||
check_admin_referer( 'bulk-users' );
|
||||
|
||||
if ( ! current_user_can( 'promote_users' ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to edit this user.' ), 403 );
|
||||
}
|
||||
|
||||
$editable_roles = get_editable_roles();
|
||||
$role = $_REQUEST['new_role'];
|
||||
|
||||
// Mock `none` as editable role.
|
||||
$editable_roles['none'] = array(
|
||||
'name' => __( '— No role for this site —' ),
|
||||
);
|
||||
|
||||
if ( empty( $editable_roles[ $role ] ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 );
|
||||
}
|
||||
|
||||
if ( 'none' === $role ) {
|
||||
$role = '';
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['users'] ) ) {
|
||||
$userids = $_REQUEST['users'];
|
||||
$update = 'promote';
|
||||
foreach ( $userids as $user_id ) {
|
||||
$user_id = (int) $user_id;
|
||||
|
||||
if ( ! current_user_can( 'promote_user', $user_id ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to edit this user.' ), 403 );
|
||||
}
|
||||
|
||||
// If the user doesn't already belong to the blog, bail.
|
||||
if ( ! is_user_member_of_blog( $user_id ) ) {
|
||||
wp_die(
|
||||
@@ -162,6 +180,8 @@ if ( $action ) {
|
||||
}
|
||||
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
// If $role is empty, none will be set.
|
||||
$user->set_role( $role );
|
||||
}
|
||||
} else {
|
||||
|
||||
+29
-15
@@ -33,8 +33,8 @@ get_current_screen()->add_help_tab(
|
||||
'<p>' . __( 'Hovering over each site reveals seven options (three for the primary site):' ) . '</p>' .
|
||||
'<ul><li>' . __( 'An Edit link to a separate Edit Site screen.' ) . '</li>' .
|
||||
'<li>' . __( 'Dashboard leads to the Dashboard for that site.' ) . '</li>' .
|
||||
'<li>' . __( 'Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.' ) . '</li>' .
|
||||
'<li>' . __( 'Delete which is a permanent action after the confirmation screen.' ) . '</li>' .
|
||||
'<li>' . __( 'Flag for Deletion, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.' ) . '</li>' .
|
||||
'<li>' . __( 'Delete Permanently which is a permanent action after the confirmation screen.' ) . '</li>' .
|
||||
'<li>' . __( 'Visit to go to the front-end of the live site.' ) . '</li></ul>',
|
||||
)
|
||||
);
|
||||
@@ -61,9 +61,9 @@ if ( isset( $_GET['action'] ) ) {
|
||||
// A list of valid actions and their associated messaging for confirmation output.
|
||||
$manage_actions = array(
|
||||
/* translators: %s: Site URL. */
|
||||
'activateblog' => __( 'You are about to activate the site %s.' ),
|
||||
'activateblog' => __( 'You are about to remove the deletion flag from the site %s.' ),
|
||||
/* translators: %s: Site URL. */
|
||||
'deactivateblog' => __( 'You are about to deactivate the site %s.' ),
|
||||
'deactivateblog' => __( 'You are about to flag the site %s for deletion.' ),
|
||||
/* translators: %s: Site URL. */
|
||||
'unarchiveblog' => __( 'You are about to unarchive the site %s.' ),
|
||||
/* translators: %s: Site URL. */
|
||||
@@ -106,6 +106,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||
|
||||
$site_details = get_site( $id );
|
||||
$site_address = untrailingslashit( $site_details->domain . $site_details->path );
|
||||
$submit = __( 'Confirm' );
|
||||
|
||||
require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
?>
|
||||
@@ -124,8 +125,18 @@ if ( isset( $_GET['action'] ) ) {
|
||||
<p><?php _e( 'Deleting a site is a permanent action that cannot be undone. This will delete the entire site and its uploads directory.' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
$submit = __( 'Confirm' );
|
||||
} elseif ( 'archiveblog' === $site_action ) {
|
||||
?>
|
||||
<div class="notice notice-warning inline">
|
||||
<p><?php _e( 'Archiving a site makes the site unavailable to its users and visitors. This is a reversible action.' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
} elseif ( 'deactivateblog' === $site_action ) {
|
||||
?>
|
||||
<div class="notice notice-warning inline">
|
||||
<p><?php _e( 'Flagging a site for deletion makes the site unavailable to its users and visitors. This is a reversible action. A super admin can permanently delete the site at a later date.' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<p><?php printf( $manage_actions[ $site_action ], "<strong>{$site_address}</strong>" ); ?></p>
|
||||
@@ -205,6 +216,9 @@ if ( isset( $_GET['action'] ) ) {
|
||||
<input type="hidden" name="action" value="delete_sites" />
|
||||
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
|
||||
<?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?>
|
||||
<div class="notice notice-warning inline">
|
||||
<p><?php _e( 'Deleting a site is a permanent action that cannot be undone. This will delete the entire site and its uploads directory.' ); ?>
|
||||
</div>
|
||||
<p><?php _e( 'You are about to delete the following sites:' ); ?></p>
|
||||
<ul class="ul-disc">
|
||||
<?php
|
||||
@@ -220,7 +234,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php submit_button( __( 'Confirm' ), 'primary' ); ?>
|
||||
<?php submit_button( __( 'Delete these sites permanently' ), 'primary' ); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
@@ -271,22 +285,22 @@ if ( isset( $_GET['action'] ) ) {
|
||||
update_blog_status( $id, 'deleted', '0' );
|
||||
|
||||
/**
|
||||
* Fires after a network site is activated.
|
||||
* Fires after a network site has its deletion flag removed.
|
||||
*
|
||||
* @since MU (3.0.0)
|
||||
*
|
||||
* @param int $id The ID of the activated site.
|
||||
* @param int $id The ID of the reactivated site.
|
||||
*/
|
||||
do_action( 'activate_blog', $id );
|
||||
break;
|
||||
|
||||
case 'deactivateblog':
|
||||
/**
|
||||
* Fires before a network site is deactivated.
|
||||
* Fires before a network site is flagged for deletion.
|
||||
*
|
||||
* @since MU (3.0.0)
|
||||
*
|
||||
* @param int $id The ID of the site being deactivated.
|
||||
* @param int $id The ID of the site being flagged for deletion.
|
||||
*/
|
||||
do_action( 'deactivate_blog', $id );
|
||||
|
||||
@@ -326,10 +340,10 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
$msg = __( 'Sites marked as spam.' );
|
||||
break;
|
||||
case 'all_delete':
|
||||
$msg = __( 'Sites deleted.' );
|
||||
$msg = __( 'Sites permanently deleted.' );
|
||||
break;
|
||||
case 'delete':
|
||||
$msg = __( 'Site deleted.' );
|
||||
$msg = __( 'Site permanently deleted.' );
|
||||
break;
|
||||
case 'not_deleted':
|
||||
$msg = __( 'Sorry, you are not allowed to delete that site.' );
|
||||
@@ -341,10 +355,10 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
$msg = __( 'Site unarchived.' );
|
||||
break;
|
||||
case 'activateblog':
|
||||
$msg = __( 'Site activated.' );
|
||||
$msg = __( 'Site deletion flag removed.' );
|
||||
break;
|
||||
case 'deactivateblog':
|
||||
$msg = __( 'Site deactivated.' );
|
||||
$msg = __( 'Site flagged for deletion.' );
|
||||
break;
|
||||
case 'unspamblog':
|
||||
$msg = __( 'Site removed from spam.' );
|
||||
|
||||
@@ -12,6 +12,11 @@ require_once __DIR__ . '/admin.php';
|
||||
|
||||
require_once ABSPATH . WPINC . '/http.php';
|
||||
|
||||
/**
|
||||
* @global int $wp_db_version WordPress database version.
|
||||
*/
|
||||
global $wp_db_version;
|
||||
|
||||
// Used in the HTML title tag.
|
||||
$title = __( 'Upgrade Network' );
|
||||
$parent_file = 'upgrade.php';
|
||||
@@ -49,10 +54,6 @@ switch ( $action ) {
|
||||
$n = ( isset( $_GET['n'] ) ) ? (int) $_GET['n'] : 0;
|
||||
|
||||
if ( $n < 5 ) {
|
||||
/**
|
||||
* @global int $wp_db_version WordPress database version.
|
||||
*/
|
||||
global $wp_db_version;
|
||||
update_site_option( 'wpmu_upgrade_site', $wp_db_version );
|
||||
}
|
||||
|
||||
@@ -135,7 +136,7 @@ switch ( $action ) {
|
||||
break;
|
||||
case 'show':
|
||||
default:
|
||||
if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $GLOBALS['wp_db_version'] ) :
|
||||
if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) :
|
||||
?>
|
||||
<h2><?php _e( 'Database Update Required' ); ?></h2>
|
||||
<p><?php _e( 'WordPress has been updated! Next and final step is to individually upgrade the sites in your network.' ); ?></p>
|
||||
|
||||
Reference in New Issue
Block a user