Help/About: Fix the user's saved WordPress.org username from being changed to wordpressdotorg when they click the About page link to install the Classic Editor plugin.

Props pento.
See #45178.

Built from https://develop.svn.wordpress.org/branches/5.0@43952


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mel Choyce 2018-11-30 16:23:46 +00:00
parent d71ccc69e3
commit 34e52b90e9
4 changed files with 8 additions and 4 deletions

View File

@ -335,7 +335,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
<p><?php _e( 'Note to users of assistive technology: if you experience usability issues with the block editor, we recommend you continue to use the Classic Editor.' ); ?></p>
<?php if ( current_user_can( 'install_plugins' ) ) { ?>
<div class="col cta">
<a class="button button-primary button-hero" href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg' ), 'save_wporg_username_' . get_current_user_id() ) ); ?>"><?php _e( 'Install the Classic Editor' ); ?></a>
<a class="button button-primary button-hero" href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ) ); ?>"><?php _e( 'Install the Classic Editor' ); ?></a>
</div>
<?php } ?>
</div>

View File

@ -190,7 +190,11 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$action = 'save_wporg_username_' . get_current_user_id();
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) {
$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
// If the save url parameter is passed with a falsey value, don't save the favorite user.
if ( ! isset( $_GET['save'] ) || $_GET['save'] ) {
update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
}
} else {
$user = get_user_option( 'wporg_favorites' );
}

View File

@ -5,7 +5,7 @@
* @package WordPress
*/
if ( ! function_exists( 'wp_latest_comments_draft_or_post_title' ) ) {
if ( ! function_exists( 'gutenberg_draft_or_post_title' ) ) {
/**
* Get the post title.
*

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-RC1-43951';
$wp_version = '5.0-RC1-43952';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.