[buddypress-trac] [BuddyPress] #4855: Method to override a plugins use of plugins.php or add filters to bp_template_title and bp_template_content

buddypress-trac noreply at wordpress.org
Wed Mar 6 21:49:58 UTC 2013


#4855: Method to override a plugins use of plugins.php or add filters to
bp_template_title and bp_template_content
------------------------------------+-----------------------
 Reporter:  modemlooper             |       Owner:
     Type:  defect (bug)            |      Status:  reopened
 Priority:  normal                  |   Milestone:  1.7
Component:  Theme                   |     Version:  1.7
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+-----------------------

Comment (by r-a-y):

 My problem is plugins.php hardcodes the options nav to use no AJAX with
 the 'no-ajax' CSS class; I want AJAX.
 ([https://buddypress.trac.wordpress.org/browser/tags/1.7-beta1/bp-themes
 /bp-default/members/single/plugins.php#L45 Line 45] in bp-default's
 plugins.php)

 I've worked around this problem for bp-default; though it's not really
 elegant.

 ----

 > My issue is a plugin calling plugins.php and you want to remove the
 plugin from using that file and your plugin use that file instead. Yes,
 there has been suggestion to dehook every call to bp_template_content.

 Follow what I mentioned in
 [https://buddypress.trac.wordpress.org/ticket/4855#comment:18 comment 18].

 Buffer around `'bp_template_content'` at a low priority and high priority
 to get rid of the plugin entirely without even knowing what was injected.

 {{{

 // start output buffer
 function bp4855_start_buffer() {
         ob_start();
 }
 add_action( 'bp_template_content', 'bp4855_start_buffer', 0 );

 // remove everything that was added in 'bp_template_content'
 function bp4855_end_buffer() {
         // if you wanted to manipulate the contents of the buffer,
         // uncomment the following line
         // $buffer = ob_get_contents();

         // stop output buffer
         ob_end_clean();

         // do all your manipulation here
         // eg. add your template part, use the $buffer variable if needed
 }
 add_action( 'bp_template_content', 'bp4855_end_buffer', 999 );
 }}}

 Any other concerns before I close this discussion?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4855#comment:27>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list