Skip to:
Content

BuddyPress.org

Changeset 9128


Ignore:
Timestamp:
11/10/2014 03:37:06 PM (10 years ago)
Author:
boonebgorges
Message:

Don't show Settings > Email tab when there's nothing to display there.

Props Mamaduka.
Fixes #5441.

Location:
trunk/src/bp-settings
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-settings/bp-settings-actions.php

    r9041 r9128  
    466466}
    467467add_action( 'bp_actions', 'bp_settings_verify_email_change' );
     468
     469/**
     470 * Removes 'Email' sub nav, if no component has registered options there.
     471 *
     472 * @since BuddyPress (2.2.0)
     473 */
     474function bp_settings_remove_email_subnav() {
     475    if ( ! has_action( 'bp_notification_settings' ) ) {
     476        bp_core_remove_subnav_item( BP_SETTINGS_SLUG, 'notifications' );
     477    }
     478}
     479add_action( 'bp_actions', 'bp_settings_remove_email_subnav' );
  • trunk/src/bp-settings/bp-settings-loader.php

    r8568 r9128  
    173173            );
    174174
    175             // Notifications
    176             $wp_admin_nav[] = array(
    177                 'parent' => 'my-account-' . $this->id,
    178                 'id'     => 'my-account-' . $this->id . '-notifications',
    179                 'title'  => __( 'Email', 'buddypress' ),
    180                 'href'   => trailingslashit( $settings_link . 'notifications' )
    181             );
     175            // Notifications - only add the tab when there is something to display there.
     176            if ( has_action( 'bp_notification_settings' ) ) {
     177                $wp_admin_nav[] = array(
     178                    'parent' => 'my-account-' . $this->id,
     179                    'id'     => 'my-account-' . $this->id . '-notifications',
     180                    'title'  => __( 'Email', 'buddypress' ),
     181                    'href'   => trailingslashit( $settings_link . 'notifications' )
     182                );
     183            }
    182184
    183185            // Delete Account
Note: See TracChangeset for help on using the changeset viewer.