[buddypress-trac] [BuddyPress Trac] #6230: BP 2.2 (and 2.2.1) feed is no longer protected by Wishlist Member

buddypress-trac noreply at wordpress.org
Thu Feb 19 21:00:11 UTC 2015


#6230: BP 2.2 (and 2.2.1)  feed is no longer protected by Wishlist Member
-----------------------------------------+------------------------------
 Reporter:  Pete Hudson                  |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Appearance                   |     Version:  2.2.1
 Severity:  normal                       |  Resolution:
 Keywords:  reporter-feedback has-patch  |
-----------------------------------------+------------------------------

Comment (by r-a-y):

 > Turns out BP creates a dummy post with ID=0 for the activity page. I
 don't understand why this is needed.

 In the past, BP used to use the page ID that was associated with the BP
 directory page (`/members/`, `/groups/`, `/activity/`).  But that caused
 issues on BP single pages like `/members/USERNAME/` and
 `/groups/GROUPNAME/`.

 We could set the page ID only on BP directory pages.  In fact, it was
 something I originally did in r8821.  I think we could bring r8821 back
 since r9322 changes how BP page items are highlighted in nav menus.  Let
 me experiment a bit.

 The alternative is for WLM to do redirect checks on the
 `'template_redirect'` hook.  Since BuddyPress overrides `$wp_query`
 properties on the 'template_redirect' hook, if WLM wants to do checks
 before other plugins like BP overrides `$wp_query`, WLM should do checks
 on the page in question as early as possible on `'template_redirect'` at
 priority zero.  See wp-includes/template-loader.php for the firing
 sequence.

 For example, try this code on a BP directory page:
 {{{

 function test_queried_object() {
     print_r( get_queried_object() );
 }
 add_action( 'template_redirect', 'test_queried_object', 0 );
 }}}


 The correct page ID is still available then.  If you change to your
 `'page_template'` filter, you will notice that the page ID is zero.

 So just to conclude either BP or WLM should make the suggested changes
 above to fix this for now.  One way or another, in the future, this will
 break again when BP moves to rewrite rules and virtual pages and we'll
 both need to look at a way to engineer solution then.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6230#comment:11>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list