BP_Settings_Component:: setup_nav (数组main_nav美元=数组(),数组sub_nav美元=数组())
设置导航。
描述
参数
- main_nav美元
-
(数组)(可选)主要导航项的数组。
默认值:数组()
- sub_nav美元
-
(数组)(可选)子导航项数组。
默认值:数组()
源
文件:bp-settings /类/ class-bp-settings-component.php
public function setup_nav($main_nav = array(), $sub_nav = array()){//确定用户使用。If (bp_displayed_user_domain()) {$user_domain = bp_displayed_user_domain();} elseif (bp_loggedin_user_domain()) {$user_domain = bp_loggedin_user_domain();} else {return;} $access = bp_core_can_edit_settings();$蛞蝓= bp_get_settings_slug ();$settings_link = trailingslashit($user_domain。美元的蛞蝓);//添加settings导航项。$main_nav = array('name' => __('Account', 'buddyboss'), 'slug' => $slug, 'position' => 21, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general'); // Add General Settings nav item. $sub_nav[] = array( 'name' => __( 'Login Information', 'buddyboss' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => $access ); // Add Email nav item. Formerly called 'Notifications', we // retain the old slug and function names for backward compat. $sub_nav[] = array( 'name' => __( 'Email Preferences', 'buddyboss' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => $access ); $sub_nav[] = array( 'name' => __( 'Export Data', 'buddyboss' ), 'slug' => 'export', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_export_data', 'position' => 80, 'user_has_access' => $access ); // Add Spam Account nav item. if ( bp_current_user_can( 'bp_moderate' ) ) { $sub_nav[] = array( 'name' => __( 'Capabilities', 'buddyboss' ), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => ! bp_is_my_profile() ); } // Add Delete Account nav item. if ( ( ! bp_disable_account_deletion() && bp_is_my_profile() ) || bp_current_user_can( 'delete_users' ) ) { $sub_nav[] = array( 'name' => __( 'Delete Account', 'buddyboss' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => ! is_super_admin( bp_displayed_user_id() ) ); } parent::setup_nav( $main_nav, $sub_nav ); }
更新日志
版本 | 描述 |
---|---|
BuddyPress 1.5.0 | 介绍了。 |