Adding Subnav Link to Group Pages
-
Under groups, I’m trying to add a subnav link to a non group page using a plugin. I got some code to work, but it seems like there should be a way a simpler way to do it. Here’s my code:
function send_invites_email_redirect() {$redirect_url_cc = bp_loggedin_user_domain() . BP_INVITE_ANYONE_SLUG . ‘/invite-new-members/group-invites/’ . bp_get_group_id() ;
bp_core_redirect($redirect_url_cc);
}function bp_send_invites_by_email_setup_nav() {
global $bp;
$group_link = $bp->root_domain . ‘/’ . $bp->groups->slug . ‘/’ . $bp->groups->current_group->slug . ‘/’;bp_core_new_subnav_item(
array(
‘name’ => __( ‘Send Invites by Email’, ‘bp-invite-anyone’ ),
‘slug’ => ‘send-invites-by-email’,
‘parent_url’ => $group_link,
‘parent_slug’ => $bp->groups->slug,
‘screen_function’ => ‘send_invites_email_redirect’,
‘position’ => 65,
‘item_css_id’ => ‘send-invites-by-email’
)
);
}
add_action( ‘wp’, ‘bp_send_invites_by_email_setup_nav’, 2 );Also, is there any way to pass a variable to the function bp_core_new_subnav_item() calls? Looks like the bp_get_group_id() doesn’t get a value for some reason. Probably because it’s no longer on a group page when the function gets called.
- The topic ‘Adding Subnav Link to Group Pages’ is closed to new replies.