BP_Notifications_Component:: setup_admin_bar (数组wp_admin_nav美元=数组())
在WordPress管理栏中设置组件项。
描述
另请参阅
- BP_Component: setup_nav ():获取$wp_admin_nav参数数组的描述。
参数
- wp_admin_nav美元
-
(数组)(可选)看到BP_Component: setup_admin_bar ()一个描述。
默认值:数组()
源
文件:bp-notifications /类/ class-bp-notifications-component.php
public function setup_admin_bar($wp_admin_nav = array()){//登录用户菜单if (is_user_logged_in()){//设置登录的用户变量。$notifications_link = trailingslashit(bp_loggedin_user_domain()。bp_get_notifications_slug ());//挂起的通知请求$count = bp_notifications_get_unread_notification_count(bp_loggedin_user_id());如果(!$title = sprintf(/*翻译器:%s:当前用户未读通知计数*/ __('Notifications %s', 'buddyboss'), ''。Bp_core_number_format ($count)。< / span >); $unread = sprintf( /* translators: %s: Unread notification count for the current user */ __( 'Unread %s', 'buddyboss' ), '' . bp_core_number_format( $count ) . '' ); } else { $title = __( 'Notifications', 'buddyboss' ); $unread = __( 'Unread', 'buddyboss' ); } // Add the "My Account" sub menus. $wp_admin_nav[] = array( 'parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $notifications_link ); // Unread. $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-unread', 'title' => $unread, 'href' => $notifications_link, 'position' => 10 ); // Read. $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-read', 'title' => __( 'Read', 'buddyboss' ), 'href' => trailingslashit( $notifications_link . 'read' ), 'position' => 20 ); } parent::setup_admin_bar( $wp_admin_nav ); }
更新日志
版本 | 描述 |
---|---|
BuddyPress 1.9.0 | 介绍了。 |