Opened 17 years ago
Closed 17 years ago
#633 closed defect (bug) (no action required)
Class member functions can't be used as subnav callback functions
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | minor | |
| Severity: | Version: | ||
| Component: | Keywords: | ||
| Cc: |
Description
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.
if ( (function_exists($function) || method_exists($function)) && ...