Using WP 3.9.1 and BuddyPress 2.0.1.

I want to add a subnav item to the "groups" tab that takes you to the "create a new group" page.

I have the following functions:

add_action( 'bp_setup_nav', 'ecomukti_add_create_village_subnav_tab', 100 );

function ecomukti_add_create_village_subnav_tab() {
global $bp;

bp_core_new_subnav_item( array(
'name' => 'Create Virtual Village',
'slug' => 'create',
'parent_url' => trailingslashit( 'step/group-details' ),
'parent_slug' => 'groups',
'screen_function' => 'ecomukti_create_village_screen',
'position' => 50

function ecomukti_create_village_screen() {
bp_core_redirect( get_option('siteurl') . "groups/create/step/group-details/" );

For the most part, this works fine - it correctly adds the subnav item. However, the problem is with my screen_function. It seems to totally ignore the screen_function. The URL created by bb_core_new_subnav_item() is http://mysite.com/members/membername/groups/step/group-details/create/ - obviously that page doesn't exist, and I really want to go to http://mysite.com/groups/step/group-details/create/ That's why my screen_function is a redirect. But no matter what I put in bp_core_redirect, the redirect doesn't happen - it still goes to http://mysite.com/members/membername/groups/step/group-details/create/ So what am I doing wrong? How can I get this function to properly redirect to the "create group" page?


You can force the link. Try:

bp_core_new_subnav_item( array(
      'name'            => 'Create Virtual Village',
      'slug'            => 'create',
      'parent_url'      => 'groups',
      'parent_slug'     => 'groups',
      'screen_function' => 'false',
      'position'        => 50,
      'link'            => get_option('siteurl') . '/groups/create/step/group-details/'

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