BP_XProfile_Component:: setup_nav (数组main_nav美元数组()数组sub_nav美元数组()

设置导航。

描述

参数

main_nav美元

数组(可选)要设置的主要导航项的数组。

默认值:数组()

sub_nav美元

数组(可选)要设置的子导航项数组。

默认值:数组()

文件:bp-xprofile /类/ class-bp-xprofile-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_profile_slug ();$profile_link = trailingslashit($user_domain。美元的蛞蝓);//添加“Profile”到主导航。$main_nav = array('name' => __('Profile', 'buddyboss'), 'slug' => $slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $this->id); // Add the subnav items to the profile. $sub_nav[] = array( 'name' => __( 'View', 'buddyboss' ), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10 ); // Edit Profile. $sub_nav[] = array( 'name' => __( 'Edit', 'buddyboss' ), 'slug' => 'edit', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_edit_profile', 'position' => 20, 'user_has_access' => $access ); // Change Avatar. if ( buddypress()->avatar->show_avatars ) { $sub_nav[] = array( 'name' => __( 'Profile Photo', 'buddyboss' ), 'slug' => 'change-avatar', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_change_avatar', 'position' => 30, 'user_has_access' => $access ); } // Change cover photo. if ( bp_displayed_user_use_cover_image_header() ) { $sub_nav[] = array( 'name' => __( 'Cover Photo', 'buddyboss' ), 'slug' => 'change-cover-image', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_change_cover_image', 'position' => 40, 'user_has_access' => $access ); } // The Settings > Profile nav item can only be set up after // the Settings component has run its own nav routine. add_action( 'bp_settings_setup_nav', array( $this, 'setup_settings_nav' ) ); parent::setup_nav( $main_nav, $sub_nav ); }

更新日志

更新日志
版本 描述
BuddyPress 1.5.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队