WordPress.org

Make WordPress Core

Changeset 43952


Ignore:
Timestamp:
11/30/2018 04:22:46 PM (12 months ago)
Author:
melchoyce
Message:

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.

Location:
branches/5.0/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-admin/about.php

    r43947 r43952  
    336336                    <?php if ( current_user_can( 'install_plugins' ) ) { ?>
    337337                        <div class="col cta">
    338                             <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>
     338                            <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>
    339339                        </div>
    340340                    <?php } ?>
  • branches/5.0/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    r41916 r43952  
    191191                if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) {
    192192                    $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
    193                     update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
     193
     194                    // If the save url parameter is passed with a falsey value, don't save the favorite user.
     195                    if ( ! isset( $_GET['save'] ) || $_GET['save'] ) {
     196                        update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
     197                    }
    194198                } else {
    195199                    $user = get_user_option( 'wporg_favorites' );
Note: See TracChangeset for help on using the changeset viewer.