本文整理汇总了PHP中bp_core_new_nav_item函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_new_nav_item函数的具体用法?PHP bp_core_new_nav_item怎么用?PHP bp_core_new_nav_item使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_new_nav_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile_tab_gifts
public function profile_tab_gifts()
{
global $bp;
bp_core_new_nav_item(array('parent_url' => bp_loggedin_user_domain() . '/gifts/', 'parent_slug' => $bp->profile->slug, 'default_subnav_slug' => 'send_gift', 'show_for_displayed_user' => false, 'name' => 'Gifts', 'slug' => 'gifts', 'screen_function' => array($this, 'send_gift_posts'), 'position' => 40));
bp_core_new_subnav_item(array('name' => 'Send Gift', 'slug' => 'send_gift', 'show_for_displayed_user' => false, 'parent_url' => bp_loggedin_user_domain() . '/gifts/', 'parent_slug' => $bp->bp_nav['gifts']['slug'], 'position' => 10, 'screen_function' => array($this, 'send_gift_posts')));
bp_core_new_subnav_item(array('name' => 'Received Gift', 'slug' => 'received_gift', 'parent_url' => bp_loggedin_user_domain() . '/gifts/', 'parent_slug' => $bp->bp_nav['gifts']['slug'], 'position' => 10, 'screen_function' => array($this, 'received_gifts_posts')));
}
示例2: bfox_bp_bible_study_setup_nav
function bfox_bp_bible_study_setup_nav()
{
global $bp;
$slug = BFOX_BIBLE_SLUG;
$link = (!empty($bp->displayed_user->domain) ? $bp->displayed_user->domain : $bp->loggedin_user->domain) . $slug . '/';
bp_core_new_nav_item(array('name' => __('Bible Study', 'bfox'), 'slug' => $slug, 'position' => 21, 'show_for_displayed_user' => true, 'screen_function' => 'bfox_bp_bible_study_calendar_screen_view', 'default_subnav_slug' => 'calendar'));
bp_core_new_subnav_item(array('name' => __('Calendar', 'bfox'), 'slug' => 'calendar', 'parent_slug' => $slug, 'parent_url' => $link, 'screen_function' => 'bfox_bp_bible_study_calendar_screen_view', 'position' => 130));
bp_core_new_subnav_item(array('name' => __('Scheduled Plans', 'bfox'), 'slug' => 'schedules', 'parent_slug' => $slug, 'parent_url' => $link, 'screen_function' => 'bfox_bp_bible_study_schedules_screen_view', 'position' => 130));
if ($slug == $bp->current_component && ('schedule' == $bp->current_action || 'delete-schedule' == $bp->current_action)) {
$schedule = bfox_bp_schedule(BfoxReadingSchedule::schedule($bp->action_variables[0]));
if ($schedule->id) {
if ($schedule->is_user_member($bp->displayed_user->id)) {
if ('schedule' == $bp->current_action) {
bfox_bp_plans_reading_redirect($schedule, $bp->action_variables[1], $bp->action_variables[2]);
$bp->current_action = "schedule/{$schedule->id}";
bp_core_new_subnav_item(array('name' => __('View Schedule', 'bfox'), 'slug' => $bp->current_action, 'parent_slug' => $slug, 'parent_url' => $link, 'screen_function' => 'bfox_bp_bible_study_edit_schedule_screen_view', 'position' => 130));
} elseif ('delete-schedule' == $bp->current_action) {
$bp->current_action = "delete-schedule/{$schedule->id}";
bp_core_new_subnav_item(array('name' => __('Delete Schedule', 'bfox'), 'slug' => $bp->current_action, 'parent_slug' => $slug, 'parent_url' => $link, 'screen_function' => 'bfox_bp_bible_study_edit_schedule_screen_view', 'position' => 130));
}
} else {
bp_core_redirect($schedule->url());
}
} else {
bp_core_redirect($link);
}
}
do_action('bfox_bp_bible_study_setup_nav', $slug, $link);
}
示例3: bp_follow_user_setup_nav
/**
* Setup profile / BuddyBar navigation.
*
* This function was moved from {@link BP_Follow_Component} in v1.3.0 due
* to the users module being toggleable.
*
* @since 1.3.0
*/
function bp_follow_user_setup_nav($main_nav = array(), $sub_nav = array())
{
global $bp;
// If we're in the admin area and we're using the WP toolbar, we don't need
// to run the rest of this method
if (defined('WP_NETWORK_ADMIN') && bp_use_wp_admin_bar()) {
return;
}
// Need to change the user ID, so if we're not on a member page, $counts variable is still calculated
$user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
$counts = bp_follow_total_follow_counts(array('user_id' => $user_id));
// BuddyBar compatibility
$domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
/** FOLLOWERS NAV ************************************************/
bp_core_new_nav_item(array('name' => sprintf(__('Following <span>%d</span>', 'bp-follow'), $counts['following']), 'slug' => $bp->follow->following->slug, 'position' => $bp->follow->params['adminbar_myaccount_order'], 'screen_function' => 'bp_follow_screen_following', 'default_subnav_slug' => 'following', 'item_css_id' => 'members-following'));
/** FOLLOWING NAV ************************************************/
bp_core_new_nav_item(array('name' => sprintf(__('Followers <span>%d</span>', 'bp-follow'), $counts['followers']), 'slug' => $bp->follow->followers->slug, 'position' => apply_filters('bp_follow_followers_nav_position', 62), 'screen_function' => 'bp_follow_screen_followers', 'default_subnav_slug' => 'followers', 'item_css_id' => 'members-followers'));
/** ACTIVITY SUBNAV **********************************************/
// Add activity sub nav item
if (bp_is_active('activity') && apply_filters('bp_follow_show_activity_subnav', true)) {
bp_core_new_subnav_item(array('name' => _x('Following', 'Activity subnav tab', 'bp-follow'), 'slug' => constant('BP_FOLLOWING_SLUG'), 'parent_url' => trailingslashit($domain . bp_get_activity_slug()), 'parent_slug' => bp_get_activity_slug(), 'screen_function' => 'bp_follow_screen_activity_following', 'position' => 21, 'item_css_id' => 'activity-following'));
}
// BuddyBar compatibility
add_action('bp_adminbar_menus', 'bp_follow_group_buddybar_items');
}
示例4: bp_em_setup_nav
/**
* bp_em_setup_nav()
*
* Sets up the user profile navigation items for the component. This adds the top level nav
* item and all the sub level nav items to the navigation array. This is then
* rendered in the template.
*/
function bp_em_setup_nav()
{
global $bp;
$count = 0;
/* Add 'Events' to the main user profile navigation */
bp_core_new_nav_item(array('name' => __('Events', 'bp-em'), 'slug' => $bp->events->slug, 'position' => 80, 'screen_function' => bp_is_my_profile() ? 'bp_em_my_events' : 'bp_em_events', 'default_subnav_slug' => bp_is_my_profile() ? 'my-events' : ''));
$em_link = $bp->loggedin_user->domain . $bp->events->slug . '/';
/* Create two sub nav items for this component */
bp_core_new_subnav_item(array('name' => __('My Profile', 'dbem'), 'slug' => 'profile', 'parent_slug' => $bp->events->slug, 'parent_url' => $em_link, 'screen_function' => 'bp_em_events', 'position' => 10, 'user_has_access' => bp_is_my_profile()));
bp_core_new_subnav_item(array('name' => __('Events I\'m Attending', 'dbem'), 'slug' => 'attending', 'parent_slug' => $bp->events->slug, 'parent_url' => $em_link, 'screen_function' => 'bp_em_attending', 'position' => 20, 'user_has_access' => bp_is_my_profile()));
bp_core_new_subnav_item(array('name' => __('My Events', 'dbem'), 'slug' => 'my-events', 'parent_slug' => $bp->events->slug, 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_events', 'position' => 30, 'user_has_access' => bp_is_my_profile()));
bp_core_new_subnav_item(array('name' => __('My Locations', 'dbem'), 'slug' => 'my-locations', 'parent_slug' => $bp->events->slug, 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_locations', 'position' => 40, 'user_has_access' => bp_is_my_profile()));
bp_core_new_subnav_item(array('name' => __('My Event Bookings', 'dbem'), 'slug' => 'my-bookings', 'parent_slug' => $bp->events->slug, 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_bookings', 'position' => 50, 'user_has_access' => bp_is_my_profile()));
/* Add a nav item for this component under the settings nav item. */
bp_core_new_subnav_item(array('name' => __('Events', 'dbem'), 'slug' => 'group-events', 'parent_slug' => $bp->groups->slug, 'parent_url' => $bp->loggedin_user->domain . $bp->groups->slug . '/', 'screen_function' => 'bp_em_my_group_events', 'position' => 60, 'user_has_access' => bp_is_my_profile()));
/* Add a nav item for this component under the settings nav item. */
bp_core_new_subnav_item(array('name' => __('Events', 'dbem'), 'slug' => 'events-settings', 'parent_slug' => $bp->settings->slug, 'parent_url' => $bp->loggedin_user->domain . $bp->settings->slug . '/', 'screen_function' => 'bp_em_screen_settings_menu', 'position' => 40, 'user_has_access' => bp_is_my_profile()));
/* Create two sub nav items for this component */
$group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';
if ($bp->current_component == 'groups') {
$count = EM_Events::count(array('group' => $bp->groups->current_group->id));
if (empty($count)) {
$count = 0;
}
}
bp_core_new_subnav_item(array('name' => sprintf(__('Events (%s)', 'dbem'), $count), 'slug' => 'events', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'bp_em_group_events', 'position' => 50, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'forums'));
}
示例5: custom_media_nav_tab
/**
* Load Custom tabs on BuddyPress
*
* @global object $bp global BuddyPress object
*/
function custom_media_nav_tab()
{
global $bp;
if (!function_exists("bp_core_new_nav_item")) {
return;
}
if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) {
return;
}
global $rtmedia;
if (function_exists("bp_is_group") && !bp_is_group()) {
if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) {
$profile_counts = $this->actual_counts($bp->displayed_user->id);
}
$tab_position = apply_filters('rtmedia_media_tab_position', 99);
if ($rtmedia->options["buddypress_enableOnProfile"] != 0) {
bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position));
}
}
if (bp_is_group() && $rtmedia->options["buddypress_enableOnGroup"] != 0) {
global $bp;
$media_enabled = true;
//filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality
$media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled);
// check if current user can view this group
$current_group = groups_get_current_group();
$is_visible_to_current_user = $current_group->is_visible;
if ($media_enabled && $is_visible_to_current_user) {
$group_counts = $this->actual_counts($bp->groups->current_group->id, "group");
$bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . RTMEDIA_MEDIA_SLUG, 'slug' => RTMEDIA_MEDIA_SLUG, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all');
}
}
}
示例6: bp_content_setup_nav
function bp_content_setup_nav()
{
global $bp;
bp_core_new_nav_item(array('name' => __('My Posts', 'buddypress'), 'slug' => 'my-posts', 'screen_function' => 'my_posts_screen_link', 'position' => 40, 'default_subnav_slug' => 'my-posts-subnav'));
bp_core_new_subnav_item(array('name' => __('', 'buddypress'), 'slug' => 'my-posts', 'parent_url' => trailingslashit(bp_loggedin_user_domain() . 'main-tab'), 'parent_slug' => 'my-posts', 'screen_function' => 'my_posts_screen_link', 'position' => 10));
do_action('bp_content_setup_nav');
}
示例7: test_should_trailingslash_link_when_link_is_autogenerated_not_using_slug
public function test_should_trailingslash_link_when_link_is_autogenerated_not_using_slug()
{
bp_core_new_nav_item(array('name' => 'foo', 'slug' => 'foo-parent', 'link' => bp_get_root_domain() . 'foo-parent/', 'default_subnav_slug' => 'bar', 'screen_function' => 'foo'));
bp_core_new_subnav_item(array('name' => 'bar', 'slug' => 'bar', 'parent_slug' => 'foo-parent', 'parent_url' => bp_get_root_domain() . 'foo-parent/', 'screen_function' => 'bar'));
$expected = bp_get_root_domain() . 'foo-parent/';
$this->assertSame($expected, buddypress()->bp_options_nav['foo-parent']['bar']['link']);
}
示例8: array
public function test_show_for_displayed_user_false_should_force_function_to_return_false_when_bp_user_has_access_is_also_false()
{
$args = array('name' => 'Foo', 'slug' => 'foo', 'show_for_displayed_user' => false);
add_filter('bp_user_has_access', '__return_false');
$retval = bp_core_new_nav_item($args);
remove_filter('bp_user_has_access', '__return_false');
$this->assertFalse($retval);
}
示例9: ec_bp_setup_nav
function ec_bp_setup_nav()
{
global $bp;
$events_link = $bp->displayed_user->domain . 'eventos/';
bp_core_new_nav_item(array('name' => 'Eventos', 'slug' => 'eventos', 'screen_function' => 'ec_show_events_list', 'position' => 0));
bp_core_new_subnav_item(array('name' => 'Eventos', 'slug' => 'mis-eventos', 'parent_url' => $events_link, 'parent_slug' => 'eventos', 'screen_function' => 'ec_show_events_list', 'position' => 10));
bp_core_new_subnav_item(array('name' => 'Calendario', 'slug' => 'mi-calendario', 'parent_url' => $events_link, 'parent_slug' => 'eventos', 'screen_function' => 'ec_show_events_calendar', 'position' => 20));
bp_core_new_subnav_item(array('name' => 'Crear Evento', 'slug' => 'evento_nuevo', 'parent_url' => $events_link, 'parent_slug' => 'eventos', 'screen_function' => 'ec_show_events_editor', 'user_has_access' => bp_is_my_profile(), 'position' => 30));
}
示例10: content_setup_nav
public function content_setup_nav()
{
global $bp;
if (!ap_opt('disable_reputation')) {
bp_core_new_nav_item(array('name' => __('Reputation', 'anspress-question-answer'), 'slug' => 'reputation', 'screen_function' => array($this, 'reputation_screen_link'), 'position' => 30, 'default_subnav_slug' => 'my-posts-subnav'));
}
bp_core_new_nav_item(array('name' => sprintf(__('Questions %s', 'anspress-question-answer'), '<span class="count">' . count_user_posts(bp_displayed_user_id(), 'question') . '</span>'), 'slug' => 'questions', 'screen_function' => array($this, 'questions_screen_link'), 'position' => 40, 'default_subnav_slug' => 'my-posts-subnav'));
bp_core_new_nav_item(array('name' => sprintf(__('Answers %s', 'anspress-question-answer'), '<span class="count">' . count_user_posts(bp_displayed_user_id(), 'answer') . '</span>'), 'slug' => 'answers', 'screen_function' => array($this, 'answers_screen_link'), 'position' => 40, 'default_subnav_slug' => 'my-posts-subnav'));
}
示例11: setup_nav
function setup_nav()
{
global $bp;
$access = 0;
if (function_exists('bp_is_my_profile')) {
$access = apply_filters('wplms_student_dashboard_access', bp_is_my_profile());
}
bp_core_new_nav_item(array('name' => __('Dashboard', 'wplms-dashboard'), 'slug' => WPLMS_DASHBOARD_SLUG, 'position' => 4, 'screen_function' => 'wplms_dashboard_template', 'show_for_displayed_user' => $access));
}
示例12: my_bp_nav_adder
function my_bp_nav_adder()
{
global $bp;
if (get_theme_mod('show-playlist')) {
bp_core_new_nav_item(array('name' => __('Paylists', 'musik'), 'slug' => 'playlists', 'position' => 1, 'screen_function' => 'Playlistsdisplay', 'default_subnav_slug' => 'playlists', 'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/', 'parent_slug' => $bp->slug));
}
if (get_theme_mod('show-likes')) {
bp_core_new_nav_item(array('name' => __('Likes', 'musik'), 'slug' => 'likes', 'position' => 1, 'screen_function' => 'Likesdisplay', 'default_subnav_slug' => 'likes', 'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/', 'parent_slug' => $bp->slug));
}
}
示例13: buddystream_profile_navigation
/**
* Add albums page for network albums (grouped)
*/
function buddystream_profile_navigation()
{
global $bp;
if (get_site_option('buddystream_social_albums') == "on") {
if (get_site_option('buddystream_social_albums_profile_navigation') == "on") {
bp_core_new_subnav_item(array('name' => __('Social albums', 'buddystream_lang'), 'slug' => 'social-album', 'parent_url' => $bp->displayed_user->domain . $bp->profile->slug . '/', 'parent_slug' => $bp->profile->slug, 'screen_function' => 'buddystream_default_album', 'position' => 80));
} else {
bp_core_new_nav_item(array('name' => __('Social albums', 'buddystream_lang'), 'slug' => 'social-album', 'position' => 12, 'default_subnav_slug' => 'albums', 'screen_function' => 'buddystream_default_album'));
}
}
}
示例14: add_bp_profile_entry
function add_bp_profile_entry()
{
global $bp;
bp_core_new_nav_item(array('name' => __('Events', Eab_EventsHub::TEXT_DOMAIN), 'slug' => 'my-events', 'show_for_displayed_user' => true, 'default_subnav_slug' => $this->_check_permissions() ? 'organized' : 'attending', 'screen_function' => '__return_false'));
if ($this->_check_permissions()) {
bp_core_new_subnav_item(array('name' => __('Organized', Eab_EventsHub::TEXT_DOMAIN), 'slug' => 'organized', 'parent_url' => $bp->displayed_user->domain . 'my-events' . '/', 'parent_slug' => 'my-events', 'screen_function' => array($this, 'bind_bp_organized_page')));
}
bp_core_new_subnav_item(array('name' => __('Attending', Eab_EventsHub::TEXT_DOMAIN), 'slug' => 'attending', 'parent_url' => $bp->displayed_user->domain . 'my-events' . '/', 'parent_slug' => 'my-events', 'screen_function' => array($this, 'bind_bp_attending_page')));
bp_core_new_subnav_item(array('name' => __('Maybe', Eab_EventsHub::TEXT_DOMAIN), 'slug' => 'mabe', 'parent_url' => $bp->displayed_user->domain . 'my-events' . '/', 'parent_slug' => 'my-events', 'screen_function' => array($this, 'bind_bp_maybe_page')));
bp_core_new_subnav_item(array('name' => __('Not Attending', Eab_EventsHub::TEXT_DOMAIN), 'slug' => 'not-attending', 'parent_url' => $bp->displayed_user->domain . 'my-events' . '/', 'parent_slug' => 'my-events', 'screen_function' => array($this, 'bind_bp_not_attending_page')));
do_action('eab-events-my_events-set_up_navigation');
}
示例15: bp_media_galleries_setup_nav
/**
* bp_media_galleries_setup_nav()
*
* Sets up the user profile navigation items for the component. This adds the top level nav
* item and all the sub level nav items to the navigation array. This is then
* rendered in the template.
*/
function bp_media_galleries_setup_nav()
{
global $bp;
/* Add 'Example' to the main user profile navigation */
bp_core_new_nav_item(array('name' => __('Media Galleries', 'bp-media-galleries'), 'slug' => $bp->media_galleries->slug, 'position' => 80, 'screen_function' => 'bp_media_galleries_view', 'default_subnav_slug' => 'view'));
$media_galleries_link = $bp->loggedin_user->domain . $bp->media_galleries->slug . '/';
bp_core_new_subnav_item(array('name' => __('Create Gallery', 'bp-media-galleries'), 'slug' => 'create', 'parent_slug' => $bp->media_galleries->slug, 'parent_url' => $media_galleries_link, 'screen_function' => 'bp_media_galleries_create', 'position' => 10, 'user_has_access' => bp_is_home()));
bp_core_new_subnav_item(array('name' => __('Upload Audio', 'bp-media-galleries'), 'slug' => 'upload-audio', 'parent_slug' => $bp->media_galleries->slug, 'parent_url' => $media_galleries_link, 'screen_function' => 'bp_media_galleries_upload_audio', 'position' => 20, 'user_has_access' => bp_is_home()));
bp_core_new_subnav_item(array('name' => __('Upload Images', 'bp-media-galleries'), 'slug' => 'upload-images', 'parent_slug' => $bp->media_galleries->slug, 'parent_url' => $media_galleries_link, 'screen_function' => 'bp_media_galleries_upload_images', 'position' => 30, 'user_has_access' => bp_is_home()));
bp_core_new_subnav_item(array('name' => __('Upload Videos', 'bp-media-galleries'), 'slug' => 'upload-video', 'parent_slug' => $bp->media_galleries->slug, 'parent_url' => $media_galleries_link, 'screen_function' => 'bp_media_galleries_upload_video', 'position' => 40, 'user_has_access' => bp_is_home()));
/* Add a nav item for this component under the settings nav item. See bp_example_screen_settings_menu() for more info */
bp_core_new_subnav_item(array('name' => __('Media Galleries', 'bp-media-galleries'), 'slug' => 'media-galleries-admin', 'parent_slug' => $bp->settings->slug, 'parent_url' => $bp->loggedin_user->domain . $bp->settings->slug . '/', 'screen_function' => 'bp_media_galleries_screen_settings_menu', 'position' => 40, 'user_has_access' => bp_is_my_profile()));
}