[buddypress-trac] [BuddyPress Trac] #6848: Mis-use of contextual_help action causes issues with other plugins

buddypress-trac noreply at wordpress.org
Wed Jan 27 19:40:23 UTC 2016


#6848: Mis-use of contextual_help action causes issues with other plugins
----------------------------------+-----------------------------
 Reporter:  garrett-eclipse       |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Component - Settings  |    Version:  2.4.0
 Severity:  normal                |   Keywords:
----------------------------------+-----------------------------
 Hello,

 I ran into an issue with Buddypress not cooperating with other plugins
 that also use the contextual_help action hook.

 For instance the Wordpress Better Emails plugin
 (https://wordpress.org/plugins/wp-better-emails/) uses the contextual_help
 action hook to set the contents of the Overview help tab. This information
 is lost once the bp_core_add_contextual_help_content function that's tied
 into the contextual_help action hook is run as $contextual_help string
 isn't being passed through and returned by the function losing all of it's
 contents.

 To quickly resolve the implementation can be updated as follows;
 1. Update the add_action call to provide the priority and accepted_args;
 {{{#!php
 <?php
 add_action( 'contextual_help', 'bp_core_add_contextual_help', 10, 3 );
 }}}
 2. Update the bp_core_add_contextual_help function to accept all of the
 parameters;
 {{{#!php
 <?php
 function bp_core_add_contextual_help( $contextual_help, $screen_id,
 $screen ) {
 }}}
 3. Return the $contextual_help string at the end of the
 bp_core_add_contextual_help function;
 {{{#!php
 <?php
 return $contextual_help;
 }}}

 This will ensure any plugins or custom functions that set the
 contextual_help string used in the default Overview help tab aren't
 overridden. If the goal is to drop the Overview tab on Buddypress
 components then the switch statement can be updated so it returns an empty
 string in all cases except default which would catch non-Buddypress
 screens.

 Also while investigating it came to my attention that this approach using
 the contextual_help action hook was deprecated in Wordpress 3.3 even
 though it will still work.
 https://codex.wordpress.org/Adding_Contextual_Help_to_Administration_Menus

 Hope that all makes sense,
 Cheers
 P.S. Buddypress Trac only has up to Version 2.4.0 listed but I do have
 2.4.3 installed.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6848>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list