bp_notifications_toolbar_menu ()
构建“Notifications”下拉框。
描述
返回
(保龄球)
源
文件:bp-notifications / bp-notifications-adminbar.php
函数bp_notifications_toolbar_menu(){全局$wp_admin_bar;如果(!Is_user_logged_in()){返回false;} $notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id(), '对象');$ count = !空($notifications) ?Count ($notifications): 0;$alert_class = (int) $count > 0 ?'pending-count alert': 'count no-alert';$menu_title = '' . number_format_i18n( $count ) . ''; $menu_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); // Add the top-level Notifications button. $wp_admin_bar->add_menu( array( 'parent' => 'top-secondary', 'id' => 'bp-notifications', 'title' => $menu_title, 'href' => $menu_link, ) ); if ( ! empty( $notifications ) ) { foreach ( (array) $notifications as $notification ) { $wp_admin_bar->add_menu( array( 'parent' => 'bp-notifications', 'id' => 'notification-' . $notification->id, 'title' => $notification->content, 'href' => $notification->href, ) ); } } else { $wp_admin_bar->add_menu( array( 'parent' => 'bp-notifications', 'id' => 'no-notifications', 'title' => __( 'No new notifications', 'buddyboss' ), 'href' => $menu_link, ) ); } return; }
更新日志
版本 | 描述 |
---|---|
BuddyPress 1.9.0 | 介绍了。 |