Skip to content
Permalink
Browse files

Help/About: Fix the user's saved WordPress.org username from being ch…

…anged to wordpressdotorg when they click the About page link to install the Classic Editor plugin.

Props pento.
See #45178.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43952 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
melchoyce committed Nov 30, 2018
1 parent 214e8c1 commit 8cbeb96732954d648f05cef04333c681650170ba
Showing with 6 additions and 2 deletions.
  1. +1 −1 src/wp-admin/about.php
  2. +5 −1 src/wp-admin/includes/class-wp-plugin-install-list-table.php
@@ -335,7 +335,7 @@
<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>
@@ -190,7 +190,11 @@ public function prepare_items() {
$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' );
}

0 comments on commit 8cbeb96

Please sign in to comment.
You can’t perform that action at this time.