Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_core_new_nav_item in plugin class


  • shanebp
    Moderator

    @shanebp

    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’ => ‘mytab_screen’,
    ‘default_subnav_slug’ => ‘mytab’
    ) );`

    The problem appears when you click the tab, then this warning appears:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘mytab_screen’ was given in …/wp-includes/plugin.php on line 406

    How do I point ‘screen_function’ to a public function in the same class ?

    This doesn’t work: `’screen_function’ => $this->mytab_screen()`

    (used outside the class but still in the plugin file, everything works)

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    Update:
    Using this gets rid of the Warning:
    `’screen_function’ => array( $this, ‘mytab_screen’ )`

    Nothing fancy, just sloppiness.

    Please close thread.

Viewing 1 replies (of 1 total)
  • The topic ‘bp_core_new_nav_item in plugin class’ is closed to new replies.
Skip to toolbar