Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/08/2017 07:21:02 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Queries: Remove author_name query variable setting when viewing profiles.

This is a relic from the days when profiles included blog posts (2010 era.)

This should be safe to remove, based on the following assessments:

  • Blog posts are no longer included in profiles
  • Setting author_name or author query-vars will cause is_author() to be set to true
  • is_author() should not return true in the context of bbPress profile pages
  • The author_name query-var is not used again later in bbPress - the displayed_user variable is instead

See https://github.com/woocommerce/woocommerce/issues/15508 for additional context.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/template-functions.php

    r6438 r6503  
    465465 *
    466466 * If it's a user page, WP_Query::bbp_is_single_user is set to true.
     467 *
    467468 * If it's a user edit page, WP_Query::bbp_is_single_user_edit is set to true
    468469 * and the the 'wp-admin/includes/user.php' file is included.
     470 *
    469471 * In addition, on user/user edit pages, WP_Query::home is set to false & query
    470  * vars 'bbp_user_id' with the displayed user id and 'author_name' with the
    471  * displayed user's nicename are added.
     472 * vars 'bbp_user_id' with the displayed user id is added.
     473 *
     474 * In 2.6.0, the 'author_name' variable is no longer set when viewing a single
     475 * user, because of is_author() weirdness. If this removal causes problems, it
     476 * may come back in a future release.
    472477 *
    473478 * If it's a forum edit, WP_Query::bbp_is_forum_edit is set to true
     
    614619        $posts_query->set( 'bbp_user_id', $the_user->ID );
    615620
    616         // Set author_name as current user's nicename to get correct posts
    617         $posts_query->set( 'author_name', $the_user->user_nicename );
    618 
    619621        // Set the displayed user global to this user
    620622        bbpress()->displayed_user = $the_user;
Note: See TracChangeset for help on using the changeset viewer.