bp_groups_group_admin_menu ()

在查看组页面时添加组管理员顶层菜单。

描述

返回

(假|空)如果不在组页面上,或者用户没有访问组管理选项,则为False。

文件:bp-groups / bp-groups-adminbar.php

函数bp_groups_group_admin_menu(){全局$wp_admin_bar;英国石油美元= buddypress ();//仅在查看组时显示。如果(!Bp_is_group () || bp_is_group_create()) {return false;} //只显示该菜单给组管理员和超级管理员。如果(!Bp_current_user_can ('bp_moderate') && !Bp_group_is_admin()){返回false;} //“Edit Group”菜单的唯一ID。 $bp->group_admin_menu_id = 'group-admin'; // Add the top-level Group Admin button. $wp_admin_bar->add_menu( array( 'id' => $bp->group_admin_menu_id, 'title' => __( 'Edit Group', 'buddyboss' ), 'href' => bp_get_group_permalink( $bp->groups->current_group ) . 'admin/edit-details/' ) ); // Index of the Manage tabs parent slug. $secondary_nav_items = $bp->groups->nav->get_secondary( array( 'parent_slug' => $bp->groups->current_group->slug . '_manage' ) ); // Check if current group has Manage tabs. if ( ! $secondary_nav_items ) { return; } // Build the Group Admin menus. foreach ( $secondary_nav_items as $menu ) { /** * Should we add the current manage link in the Group's "Edit" Admin Bar menu ? * * All core items will be added, plugins can use a new parameter in the BP Group Extension API * to also add the link to the "edit screen" of their group component. To do so, set the * the 'show_in_admin_bar' argument of your edit screen to true */ if ( $menu->show_in_admin_bar ) { $title = sprintf( __( 'Edit Group %s', 'buddyboss' ), $menu->name ); // Title is specific for delete. if ( 'delete-group' == $menu->slug ) { $title = sprintf( __( '%s Group', 'buddyboss' ), $menu->name ); if ( bp_is_active( 'forums' ) && function_exists( 'bbp_is_group_forums_active' ) ) { if ( bbp_is_group_forums_active() ) { $wp_admin_bar->add_menu( array( 'parent' => $bp->group_admin_menu_id, 'id' => get_option( '_bbp_forum_slug', 'forum' ), 'title' => 'Edit Group Discussion', 'href' => bp_get_groups_action_link( 'admin/' . get_option( '_bbp_forum_slug', 'forum' ) ) ) ); } } } $wp_admin_bar->add_menu( array( 'parent' => $bp->group_admin_menu_id, 'id' => $menu->slug, 'title' => $title, 'href' => bp_get_groups_action_link( 'admin/' . $menu->slug ) ) ); } } }

更新日志

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

问题吗?

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