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

设置组件导航。

描述

另请参阅

参数

main_nav美元

数组(可选)看到BP_Component: setup_nav ()为描述。

默认值:数组()

sub_nav美元

数组(可选)看到BP_Component: setup_nav ()为描述。

默认值:数组()

文件:bp-friends /类/ class-bp-friends-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_friends_slug ();$friends_link = trailingslashit($user_domain。美元的蛞蝓);//添加'Connections'到主导航。$ count = friends_get_total_friend_count (); $class = ( 0 === $count ) ? 'no-count' : 'count'; $main_nav_name = sprintf( /* translators: %s: Connection count for the current user */ __( 'Connections %s', 'buddyboss' ), sprintf( '%s', esc_attr( $class ), bp_core_number_format( $count ) ) ); $main_nav = array( 'name' => $main_nav_name, 'slug' => $slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $this->id ); // Add the subnav items to the friends nav item. $sub_nav[] = array( 'name' => ! bp_is_my_profile() ? __( 'All Connections', 'buddyboss' ) : __( 'My Connections', 'buddyboss' ), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => $slug, 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends' ); if ( bp_get_mutual_friendships() ) { $sub_nav[] = array( 'name' => __( 'Mutual Connections', 'buddyboss' ), 'slug' => 'mutual', 'parent_url' => $friends_link, 'parent_slug' => $slug, 'screen_function' => 'friends_screen_mutual_friends', 'position' => 20, 'user_has_access' => ! bp_is_my_profile() && bp_loggedin_user_id() ); } $sub_nav[] = array( 'name' => __( 'Requests', 'buddyboss' ), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => $slug, 'screen_function' => 'friends_screen_requests', 'position' => 30, 'user_has_access' => $access ); parent::setup_nav( $main_nav, $sub_nav ); }

更新日志

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

问题吗?

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