In a plugin class, I'm successfully creating a new tab on a Member page using:

    bp_core_new_nav_item( array(
    'name' => __( 'MyTab', 'bp' ),
    'slug' => 'mytab',
    'position' => 200,
    'screen_function' => array( $this, 'mytab_screen' ),
    'default_subnav_slug' => 'mytab'
) );

The problem appears when you click the tab. The function is found - this Warning DOES NOT appear:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback etc

But the function is not called and you end up on the 'It seems we can’t find what you’re looking for.' page.

Am I using the correct approach to point 'screen_function' to a public function in the same class ?


That is the correct approach.

The problem was in the function mytab_screen() I wasn't using 'array' for the 2nd parameter in the add_action for the template call.

Nothing fancy, just sloppiness.

Not the answer you're looking for? Browse other questions tagged or ask your own question.