Skip to:

Opened 15 years ago

Closed 15 years ago

#633 closed defect (bug) (no action required)

Class member functions can't be used as subnav callback functions

Reported by: burtadsit's profile burtadsit Owned by:
Milestone: Priority: minor
Severity: Version:
Component: Keywords:


I was helping somebody figure out why their call to bp_core_add_subnav_item() was failing. Turns out the $function parameter in bp_core_add_subnav_item() was a class method. That function is using function_exists() to check for a valid function name. By changing this:


if ( function_exists($function) && $user_has_access && $bp->current_action == $slug && $bp->current_component == $parent_id )

add_action( 'wp', $function, 3 );


To also use method_exists() for the passed array('classname','methodname') we can use class methods as subnav item callback functions.

Change History (2)

#1 @burtadsit
15 years ago

if ( (function_exists($function) || method_exists($function)) && ...

#2 @apeatling
15 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Better off creating a wrapper function and calling that. It can get messy if you start allowing this.

Note: See TracTickets for help on using tickets.