Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#7253 closed defect (bug) (fixed)

On cleanup, theme compat sets `is_page` to true even if it wasn't to begin with

Reported by: boonebgorges's profile boonebgorges Owned by: boonebgorges's profile boonebgorges
Milestone: 2.7 Priority: normal
Severity: normal Version: 1.9.2
Component: Core Keywords: has-patch 2nd-opinion
Cc:

Description

During the normal theme compat process, BuddyPress hijacks the content of a WP page to display its own content. Within the_content(), BP needs is_page() to be false, so it sets $wp_query->is_page to false. At the end of the loop, it resets this value to true. This works fine during a regular BP page load, because in this case, is_page will always be true when the loop starts.

However, if you manage to use theme compat in a non-page context (it can be done!!), things break a bit. Specifically, if a plugin uses theme compat on, say, a post-type archive, then bp_theme_compat_loop_end() will set is_page to true at the end of the loop, which results in errors for code that runs after the loop is finished.

This should be fixable by only setting the is_page_toggled flag when, in fact, is_page is actually toggled. I don't see any harm in this, but I'd like a sanity check before continuing with it.

Attachments (1)

7253.diff (759 bytes) - added by boonebgorges 10 years ago.

Download all attachments as: .zip

Change History (4)

@boonebgorges
10 years ago

#1 @boonebgorges
10 years ago

  • Keywords 2nd-opinion added

#2 @DJPaul
10 years ago

Seems to make sense

#3 @boonebgorges
10 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 11092:

Theme Compat: Only set is_page back to true after a loop if it was true to begin with.

Fixes #7253.

Note: See TracTickets for help on using tickets.