Making WordPress.org


Ignore:
Timestamp:
06/01/2017 05:03:50 PM (7 years ago)
Author:
Otto42
Message:

Plugin Directory: Add My Favorites back to main page. Fixes #2836. props @SergeyBiryukov

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r5500 r5532  
    654654     */
    655655    public function pre_get_posts( $wp_query ) {
    656         if ( is_admin() || ! $wp_query->is_main_query() ) {
     656        if ( is_admin() ) {
    657657            return;
    658658        }
     
    721721
    722722        // Author Archives need to be created
    723         if ( isset( $wp_query->query['author_name'] ) || isset( $wp_query->query['author'] ) ) {
    724             $user = isset( $wp_query->query['author_name'] ) ? $wp_query->query['author_name'] : (get_user_by( 'id', $wp_query->query['author'])->user_nicename);
     723        if ( $wp_query->is_main_query() && ( isset( $wp_query->query['author_name'] ) || isset( $wp_query->query['author'] ) ) ) {
     724            $user = isset( $wp_query->query['author_name'] ) ? $wp_query->query['author_name'] : get_user_by( 'id', $wp_query->query['author'] )->user_nicename;
    725725
    726726            $viewing_own_author_archive = is_user_logged_in() && ( current_user_can( 'plugin_review' ) || 0 === strcasecmp( $user, wp_get_current_user()->user_nicename ) );
     
    757757
    758758        // For singular requests, or self-author profile requests allow restricted post_status items to show on the front-end.
    759         if ( $viewing_own_author_archive || ( is_user_logged_in() && !empty( $wp_query->query_vars['name'] ) ) ) {
     759        if ( $wp_query->is_main_query() && ( $viewing_own_author_archive || is_user_logged_in() && !empty( $wp_query->query_vars['name'] ) ) ) {
    760760
    761761            $wp_query->query_vars['post_status'] = array( 'approved', 'publish', 'closed', 'disabled' );
Note: See TracChangeset for help on using the changeset viewer.