Skip to content

Instantly share code, notes, and snippets.

@scarabcoder
Created July 29, 2020 14:47
Show Gist options
  • Save scarabcoder/511e463f334214cc6a06de378500985f to your computer and use it in GitHub Desktop.
Save scarabcoder/511e463f334214cc6a06de378500985f to your computer and use it in GitHub Desktop.
add_action( 'bp_settings_setup_nav', 'bbm_add_change_passcode_nav_items' );
function bbm_add_change_passcode_nav_items() {
bp_core_new_subnav_item( array(
'name' => __( 'Billing', 'buddyboss' ),
'slug' => 'billing',
'parent_url' => trailingslashit( get_site_url() ),
'parent_slug' => 'settings',
'screen_function' => 'bp_settings_screen_billing',
'position' => 25,
'user_has_access' => true,
), 'members' );
bp_core_new_subnav_item( array(
'name' => __( 'Change Passcode', 'buddyboss' ),
'slug' => 'change-passcode',
'parent_url' => trailingslashit( get_site_url() ),
'parent_slug' => 'settings',
'screen_function' => 'bp_settings_screen_changepasscode',
'position' => 26,
'user_has_access' => true,
), 'members' );
}
@scarabcoder
Copy link
Author

scarabcoder commented Jul 29, 2020

The URL slug they go to is set by 'parent_url' and 'slug' in the options array. The slug is just appended to the parent URL when being displayed. In the billing button example, that would be "https://example.com/billing", where example.com would be the site URL.
The screen_function doesn't have a purpose in this case, I believe it might be used if you wanted to display a page inside the account management area. I haven't tested that though.

The menu icon is set via CSS, you just need to set the "content" value.  The HTML element ID looks like it's being set from the slug value, so in the example above I would use the following CSS to set the icon to a shopping cart:

#buddypress .bp-esttings-container .bp-navs a#billing:before {  
  content: '\E905';
}

All of the icons can be found on this page: https://www.buddyboss.com/resources/font-cheatsheet/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment