Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Created June 22, 2021 13:26
Show Gist options
  • Select an option

  • Save wbcomdev/6b21f4e8eb1adbbdf310115c0089b7ce to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/6b21f4e8eb1adbbdf310115c0089b7ce to your computer and use it in GitHub Desktop.
<?php
/**
* Add bp profile navigation for create group.
*/
function wbcom_add_bp_profile_tab_for_create_group() {
if ( ! bp_is_my_profile() ) {
return;
}
$slug = bp_get_groups_slug();
$access = bp_core_can_edit_settings() && bp_user_can_create_groups();
$groups_link = trailingslashit( bp_core_get_user_domain() . $slug );
bp_core_new_subnav_item(
array(
'name' => __( 'Create Group' ),
'slug' => 'create-group',
'parent_slug' => $slug,
'parent_url' => $groups_link,
'position' => 1010,
'user_has_access' => $access,
'screen_function' => function () {
},
'show_in_admin_bar' => false,
'link' => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
)
);
}
add_action( 'bp_groups_setup_nav', 'wbcom_add_bp_profile_tab_for_create_group', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment