[buddypress-trac] [BuddyPress] #5021: Shortcode contents don't display in non-standard BP 1.7 themes

buddypress-trac noreply at wordpress.org
Wed May 29 17:20:47 UTC 2013

#5021: Shortcode contents don't display in non-standard BP 1.7 themes
 Reporter:  sensibleplugins         |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  1.8
Component:  Core                    |     Version:  1.7
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |

Comment (by boonebgorges):

 Hey all - Thanks for your work on this so far.

 r7128 does cause problems for plugins (or, at least, one of mine -
 BuddyPress Docs). Basically, because I'm using `the_content()` inside of
 my custom BP Docs loop, the BP theme compat filters are being run
 recursively, and my page loads with lots of nested Doc directories. This
 is not good :)

 FWIW, I am *not* using `query_posts()`, but am invoking a new `WP_Query`
 object. I'm looking at the way that `in_the_loop()` works, and I don't
 think that it's a reliable method for testing whether we're in the main
 query - it seems to be run anytime you call the `the_post()` method on a
 `WP_Query` object.

 I'm afraid that r-a-y's 5021.4.patch doesn't fix the issue for me. Not
 sure why.

 ericlewis and I have spent the last hour or two messing around to figure
 out the cause. We don't have a complete grasp on the problem, but
 5021.05.patch is what we had to do to fix the problem.

 First, we manually remove the `bp_theme_compat_main_loop_start` from
 `loop_start` the first time it runs. This is a similar concept to r-a-y's
 "runonce" idea, but more direct. (It doesn't work to remove at `loop_end`,
 because the queries are nested - `loop_end` on the outer loop only runs
 *after* it's run on the inner loop.)

 When we made this change alone, it reduced the infinite recursion to a
 single level of recursion: content was appearing only twice. We found
 that, by removing the re-adding of the `bp_replace_the_content` filter in
 `bp_buffer_template_part()`, the second level of recursion was avoided
 too. And really, there is no reason why we should be readding this filter
 in the first place: in what scenario would we want theme compat to run
 twice on the same page?

 We don't totally understand why these changes fix the issue. The problems
 don't manifest with single post pages (like single Docs, or with bp-pages,
 which are single WP posts), but only with post type archives like those
 used in BP Docs directories. We're hoping that maybe JJJ will have some
 insight. In any case, the changes suggested in .05.patch seem in the
 spirit of r-a-y's .4.patch, but are more conservative and more guaranteed
 to work in all cases (at least, our experience is showing this).

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

More information about the buddypress-trac mailing list