本文整理汇总了PHP中bp_core_remove_subnav_item函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_remove_subnav_item函数的具体用法?PHP bp_core_remove_subnav_item怎么用?PHP bp_core_remove_subnav_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_remove_subnav_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_activity_nav
public function add_activity_nav()
{
$bp = buddypress();
if (!bp_is_user() || !is_user_logged_in() || !bp_is_my_profile()) {
return;
}
$activity_link = bp_core_get_user_domain(bp_loggedin_user_id()) . $bp->activity->slug . '/';
//add to user activity subnav if it is logged in users profile
bp_core_new_subnav_item(array('name' => __('News Feed', 'fb-like-activity-stream'), 'slug' => MYSTREAM_ACTIVITY_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => array($this, 'activity_screen'), 'position' => 2, 'user_has_access' => bp_is_my_profile()));
//bp_core_new_nav_default(array('parent_slug'=>$bp->activity->slug,'subnav_slug'=>MYSTREAM_ACTIVITY_SLUG,'screen_function'=>array($this,'activity_screen')));
bp_core_remove_subnav_item('activity', 'just-me');
$sub_nav = array('name' => __('My Posts', 'buddypress'), 'slug' => 'personal', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_my_activity', 'position' => 10);
bp_core_new_subnav_item($sub_nav);
}
示例2: test_backcompat_remove_group_nav_items
public function test_backcompat_remove_group_nav_items()
{
$g1 = $this->factory->group->create();
// In group context
$g_obj = groups_get_group($g1);
$this->go_to(bp_get_group_permalink($g_obj));
bp_core_new_subnav_item(array('name' => 'Clam', 'slug' => 'clam', 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => bp_get_group_permalink($g_obj), 'screen_function' => 'clam_subnav'));
bp_core_remove_subnav_item($g_obj->slug, 'clam');
$nav = bp_get_nav_menu_items('groups');
$found = false;
foreach ($nav as $_nav) {
if ('clam' === $_nav->css_id) {
$found = true;
break;
}
}
$this->assertFalse($found);
}
示例3: bp_core_remove_nav_item
/**
* bp_core_remove_nav_item()
*
* Removes a navigation item from the sub navigation array used in BuddyPress themes.
*
* @package BuddyPress Core
* @param $parent_id The id of the parent navigation item.
* @param $slug The slug of the sub navigation item.
*/
function bp_core_remove_nav_item( $parent_id ) {
global $bp;
/* Unset subnav items for this nav item */
if ( is_array( $bp->bp_options_nav[$parent_id] ) ) {
foreach( (array)$bp->bp_options_nav[$parent_id] as $subnav_item ) {
bp_core_remove_subnav_item( $parent_id, $subnav_item['slug'] );
}
}
unset( $bp->bp_nav[$parent_id] );
}
示例4: navigation
function navigation()
{
global $bp;
// Main navigation
$bp->bp_nav['profile']['position'] = 10;
$bp->bp_nav['activity']['position'] = 20;
$bp->bp_nav['forums']['position'] = 30;
$bp->bp_nav['friends']['position'] = 40;
$bp->bp_nav['groups']['position'] = 50;
$bp->bp_nav['messages']['position'] = 60;
$bp->bp_nav['notifications']['position'] = 70;
$bp->bp_nav['settings']['position'] = 90;
// Profile biography
$bp->bp_options_nav['profile']['public']['name'] = 'Player Biography';
$bp->bp_options_nav['profile']['change-avatar']['name'] = 'Change Avatar';
$bp->bp_options_nav['profile']['change-avatar']['link'] = $bp->displayed_user->domain . 'profile/change-avatar';
if (!bp_is_my_profile() && !current_user_can('edit_users')) {
$bp->bp_options_nav['profile']['change-avatar']['user_has_access'] = false;
}
// Profile activity
$bp->bp_options_nav['activity']['just-me']['name'] = 'All Activity';
// Profile forums
$bp->bp_options_nav['forums']['replies']['name'] = 'Recent Post Tracker';
if (!current_user_can('moderate_comments')) {
$bp->bp_options_nav['forums']['replies']['user_has_access'] = false;
}
$bp->bp_options_nav['forums']['favorites']['name'] = 'Favorite Topics';
// Profile settings
$bp->bp_options_nav['settings']['general']['name'] = 'Edit Account Info';
$bp->bp_options_nav['settings']['notifications']['name'] = 'Notification Preferences';
$bp->bp_options_nav['settings']['profile']['user_has_access'] = false;
// Custom edit profile screen
bp_core_remove_subnav_item('profile', 'edit');
if (bp_is_my_profile() || current_user_can('edit_users')) {
bp_core_new_subnav_item(array('name' => 'Edit Profile', 'slug' => 'edit', 'parent_url' => $bp->displayed_user->domain . $bp->profile->slug . '/', 'parent_slug' => $bp->profile->slug, 'screen_function' => array($this, 'edit_profile_screen'), 'position' => 20));
}
// Remove activity favorites, because they are dumb
bp_core_remove_subnav_item('activity', 'favorites');
// Add moderation and infraction management panel
if (bp_is_user() && (bp_is_my_profile() || current_user_can('moderate'))) {
// Get the user object
global $user;
$user = new Apoc_User(bp_displayed_user_id(), 'profile');
$level = $user->warnings['level'];
$level = $level > 0 ? '<span class="activity-count">' . $level . '</span>' : '';
$notes = $user->mod_notes['count'];
$notes = $notes > 0 ? '<span class="activity-count">' . $notes . '</span>' : '';
bp_core_new_nav_item(array('name' => 'Infractions' . $level, 'slug' => 'infractions', 'position' => 80, 'screen_function' => array($this, 'infractions_screen'), 'default_subnav_slug' => 'status', 'item_css_id' => 'infractions'));
// Add infraction overview screen
bp_core_new_subnav_item(array('name' => 'History' . $level, 'slug' => 'status', 'parent_url' => $bp->displayed_user->domain . 'infractions/', 'parent_slug' => 'infractions', 'screen_function' => array($this, 'infractions_screen'), 'position' => 10));
// Add send warning screen
if (current_user_can('moderate')) {
bp_core_new_subnav_item(array('name' => 'Issue Warning', 'slug' => 'issue', 'parent_url' => $bp->displayed_user->domain . 'infractions/', 'parent_slug' => 'infractions', 'screen_function' => array($this, 'warning_screen'), 'position' => 30));
// Add moderator notes screen
bp_core_new_subnav_item(array('name' => 'Mod Notes' . $notes, 'slug' => 'notes', 'parent_url' => $bp->displayed_user->domain . 'infractions/', 'parent_slug' => 'infractions', 'screen_function' => array($this, 'modnotes_screen'), 'position' => 20));
}
}
// Group profile navigation
if (bp_is_group()) {
$group_id = bp_get_current_group_id();
// Add activity tab
bp_core_new_subnav_item(array('name' => 'Activity', 'slug' => 'activity', 'parent_slug' => $bp->groups->current_group->slug, 'parent_url' => bp_get_group_permalink($bp->groups->current_group), 'screen_function' => array($this, 'group_activity_screen'), 'position' => 65));
// Rename group navigation elements
$bp->bp_options_nav[$bp->groups->current_group->slug]['admin']['name'] = 'Admin';
}
}
示例5: bp_registration_options_remove_compose_message
/**
* Hide Compose menu from pending users.
*
* @since 4.2.3
*/
function bp_registration_options_remove_compose_message()
{
if (true === bp_registration_get_moderation_status(get_current_user_id())) {
bp_core_remove_subnav_item('messages', 'compose');
}
}
示例6: bbg_remove_activity_friends_subnav
/**
* REMOVE TABS FROM PROFILE HEADER
*
* @since BuddyBoss 1.5
*/
function bbg_remove_activity_friends_subnav()
{
global $bp;
bp_core_remove_subnav_item('activity', 'friends');
bp_core_remove_subnav_item('activity', 'mentions');
bp_core_remove_subnav_item('activity', 'groups');
if (!bp_is_my_profile()) {
bp_core_remove_subnav_item('activity', 'favorites');
}
}
示例7: mb_profile_menu_tabs
function mb_profile_menu_tabs()
{
global $bp;
$bp->bp_nav['notifications']['position'] = 50;
$bp->bp_nav['messages']['position'] = 30;
$bp->bp_nav['activity'] = false;
$bp->bp_nav['groups'] = false;
$bp->bp_nav['settings'] = false;
$bp->bp_nav['followers'] = false;
$bp->bp_nav['friends'] = false;
$bp->bp_nav['following']['name'] = 'Избранное';
$bp->bp_nav['profile']['public']['name'] = 'Избранное';
$bp->bp_options_nav['profile']['change-avatar']['name'] = 'Изменить аватар';
$bp->bp_options_nav['profile']['public']['name'] = 'Личные данные';
bp_core_remove_subnav_item('profile', 'edit');
bp_core_new_nav_item(array('name' => 'Стать мастером', 'slug' => 'master', 'position' => 100, 'default_subnav_slug' => 'published', 'screen_function' => 'mb_author_posts'));
}
示例8: alt_bp_remove_general
function alt_bp_remove_general()
{
global $bp;
bp_core_remove_subnav_item($bp->settings->slug, 'general');
}
示例9: invite_anyone_remove_invite_subnav
function invite_anyone_remove_invite_subnav()
{
global $bp;
if ($bp->groups->group_creation_steps['group-invites']) {
unset($bp->groups->group_creation_steps['group-invites']);
}
bp_core_remove_subnav_item($bp->groups->slug, 'send-invites');
}
示例10: bp_notifications_manager_subnav
/**
* Hide Notification subnav item and menu element and all acces
* to notifications settings page if bp_notifications_manager_disabled is yes
*/
function bp_notifications_manager_subnav()
{
if (get_option('bp_notifications_manager_disabled') == 'yes') {
global $bp;
// if current user is not admin
//if( !is_site_admin() ){ // this work only for bp 1.6 ( so i use !current_user_can('manage_options') to check if is admin user)
if (!current_user_can('manage_options')) {
bp_core_remove_subnav_item($bp->settings->slug, 'notifications');
//bp_core_remove_nav_item( $bp->settings->slug, 'notifications' );
// //remove notifcation subnav item and notification link for adminbar
//bp_core_remove_subnav_item($bp->settings->slug, 'notifications');
//remove_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
// remove notification setting link from wp adminbar if is bp use it
if (bp_use_wp_admin_bar()) {
$bp->temp_slug = $slug;
add_action('wp_before_admin_bar_render', create_function('', 'global $bp, $wp_admin_bar; $wp_admin_bar->remove_menu( "my-account-settings-notifications" );'));
}
}
}
}
示例11: invite_anyone_remove_invite_subnav
function invite_anyone_remove_invite_subnav()
{
global $bp;
if (invite_anyone_group_invite_access_test() == 'friends') {
return;
}
if (isset($bp->groups->group_creation_steps['group-invites'])) {
unset($bp->groups->group_creation_steps['group-invites']);
}
// BP 1.5 / BP 1.2
$parent_slug = isset($bp->groups->root_slug) && isset($bp->groups->current_group->slug) ? $bp->groups->current_group->slug : $bp->groups->slug;
bp_core_remove_subnav_item($parent_slug, 'send-invites');
}
示例12: thatcamp_mod_user_nav
/**
* Modify the user nav before it gets rendered, so we remove redundant items
*/
function thatcamp_mod_user_nav()
{
global $bp;
if (bp_is_active('xprofile')) {
$bp->bp_nav['profile']['name'] = 'About';
$bp->bp_nav['profile']['position'] = 5;
}
if (bp_is_active('activity')) {
bp_core_remove_subnav_item('activity', 'mentions');
bp_core_remove_subnav_item('activity', 'favorites');
bp_core_remove_subnav_item('activity', 'friends');
bp_core_remove_subnav_item('activity', 'camps');
}
if (bp_is_active('blogs')) {
bp_core_remove_nav_item('blogs');
}
if (bp_is_active('groups')) {
bp_core_remove_subnav_item('camps', 'invites');
}
/**
if ( bp_is_active( 'messages' ) ) {
bp_core_remove_nav_item( 'messages' );
}
**/
if (bp_is_active('settings') && is_user_logged_in()) {
bp_core_remove_nav_item('settings');
}
// There's a baffling bug in BuddyPress that makes this necessary
// I blame the Buddybar
if (is_user_logged_in()) {
$activity_base = trailingslashit(bp_displayed_user_domain() . bp_get_activity_slug());
} else {
$activity_base = bp_get_activity_slug() . '/';
}
$bp->bp_nav['blogs'] = array('name' => 'Blog Posts', 'slug' => 'blogs', 'link' => add_query_arg('a_type', 'blog_posts', $activity_base), 'css_id' => 'blogs', 'show_for_displayed_user' => true, 'position' => 70, 'screen_function' => 'bp_activity_screen_my_activity');
$bp->bp_nav['comments'] = array('name' => 'Blog Comments', 'slug' => 'comments', 'link' => add_query_arg('a_type', 'blog_comments', $activity_base), 'css_id' => 'comments', 'show_for_displayed_user' => true, 'position' => 73, 'screen_function' => 'bp_activity_screen_my_activity');
$bp->bp_nav['forums'] = array('name' => 'Forum Posts', 'slug' => 'forums', 'link' => add_query_arg('a_type', 'forums', $activity_base), 'css_id' => 'forums', 'show_for_displayed_user' => true, 'position' => 90, 'screen_function' => 'bp_activity_screen_my_activity');
$bp->bp_nav['favorites'] = array('name' => 'Favorites', 'slug' => 'favorites', 'link' => add_query_arg('a_type', 'favorites', $activity_base), 'css_id' => 'favorites', 'show_for_displayed_user' => false, 'position' => 100, 'screen_function' => 'bp_activity_screen_my_activity');
$bp->bp_nav[bp_get_groups_slug()]['name'] = str_replace('Groups', 'Camps', $bp->bp_nav[bp_get_groups_slug()]['name']);
// Cheating: Put Camps before Friends
if (isset($bp->bp_nav[bp_get_groups_slug()])) {
$bp->bp_nav[bp_get_groups_slug()]['position'] = 55;
}
// Correct the Edit My Profile link
if (isset($bp->bp_options_nav['profile']['edit'])) {
remove_filter('edit_profile_url', 'bp_members_edit_profile_url', 10, 3);
$bp->bp_options_nav['profile']['edit']['link'] = get_edit_profile_url(get_current_user_id());
add_filter('edit_profile_url', 'bp_members_edit_profile_url', 10, 3);
}
}
示例13: bp_core_remove_nav_item
/**
* Removes a navigation item from the sub navigation array used in BuddyPress themes.
*
* @package BuddyPress Core
* @param $parent_id The id of the parent navigation item.
* @param $slug The slug of the sub navigation item.
*/
function bp_core_remove_nav_item($parent_id)
{
global $bp;
// Unset subnav items for this nav item
if (isset($bp->bp_options_nav[$parent_id]) && is_array($bp->bp_options_nav[$parent_id])) {
foreach ((array) $bp->bp_options_nav[$parent_id] as $subnav_item) {
bp_core_remove_subnav_item($parent_id, $subnav_item['slug']);
}
}
if ($function = $bp->bp_nav[$parent_id]['screen_function']) {
if (!is_object($function[0])) {
remove_action('bp_screens', $function);
} else {
remove_action('bp_screens', array(&$function[0], $function[1]));
}
}
unset($bp->bp_nav[$parent_id]);
}
示例14: bp_settings_remove_email_subnav
/**
* Removes 'Email' sub nav, if no component has registered options there.
*
* @since 2.2.0
*/
function bp_settings_remove_email_subnav()
{
if (!has_action('bp_notification_settings')) {
bp_core_remove_subnav_item(BP_SETTINGS_SLUG, 'notifications');
}
}
示例15: bp_core_remove_nav_item
/**
* Remove a nav item from the navigation array.
*
* @param int $parent_id The slug of the parent navigation item.
*
* @return bool Returns false on failure, ie if the nav item can't be found.
*/
function bp_core_remove_nav_item($parent_id)
{
$bp = buddypress();
// Unset subnav items for this nav item
if (isset($bp->bp_options_nav[$parent_id]) && is_array($bp->bp_options_nav[$parent_id])) {
foreach ((array) $bp->bp_options_nav[$parent_id] as $subnav_item) {
bp_core_remove_subnav_item($parent_id, $subnav_item['slug']);
}
}
if (empty($bp->bp_nav[$parent_id])) {
return false;
}
if ($function = $bp->bp_nav[$parent_id]['screen_function']) {
// Remove our screen hook if screen function is callable
if (is_callable($function)) {
remove_action('bp_screens', $function, 3);
}
}
unset($bp->bp_nav[$parent_id]);
}