本文整理汇总了PHP中BP_Component::setup_nav方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Component::setup_nav方法的具体用法?PHP BP_Component::setup_nav怎么用?PHP BP_Component::setup_nav使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Component
的用法示例。
在下文中一共展示了BP_Component::setup_nav方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_nav
/**
* Setup BuddyBar navigation
* Sets up user tabs
*
*/
public function setup_nav($main_nav = array(), $main_nav = array())
{
// Define local variables
$sub_nav = array();
$screen = BuddyBlog_Screens::get_instance();
//instance of the blog screen
$total_posts = 0;
if (bp_is_my_profile()) {
$total_posts = buddyblog_get_total_posted(bp_displayed_user_id());
} else {
$total_posts = buddyblog_get_total_published_posts(bp_displayed_user_id());
}
//
// Add 'Blog' to the main navigation
$main_nav = array('name' => sprintf(__('Blog <span>%d</span>', 'buddyblog'), $total_posts), 'slug' => $this->slug, 'position' => 70, 'screen_function' => array($screen, 'my_posts'), 'default_subnav_slug' => BUDDYBLOG_ARCHIVE_SLUG, 'item_css_id' => $this->id);
//whether to link to logged in user or displayed user
if (!bp_is_my_profile()) {
$blog_link = trailingslashit(bp_displayed_user_domain() . $this->slug);
} else {
$blog_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
}
// Add the Group Invites nav item
$sub_nav[] = array('name' => __('Posts', 'buddyblog'), 'slug' => BUDDYBLOG_ARCHIVE_SLUG, 'parent_url' => $blog_link, 'parent_slug' => $this->slug, 'screen_function' => array($screen, 'my_posts'), 'position' => 30);
$sub_nav[] = array('name' => __('New Post', 'buddyblog'), 'slug' => 'edit', 'parent_url' => $blog_link, 'parent_slug' => $this->slug, 'screen_function' => array($screen, 'new_post'), 'user_has_access' => bp_is_my_profile(), 'position' => 30);
parent::setup_nav($main_nav, $sub_nav);
}
示例2: array
/**
* Setup BuddyBar navigation
*/
function setup_nav()
{
// Define local variable
$sub_nav = array();
// Add the settings navigation item
$main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
// Determine user to use
if (bp_displayed_user_domain()) {
$user_domain = bp_displayed_user_domain();
} elseif (bp_loggedin_user_domain()) {
$user_domain = bp_loggedin_user_domain();
} else {
return;
}
$settings_link = trailingslashit($user_domain . $this->slug);
// Add General Settings nav item
$sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
// Add Notifications nav item
$sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
// Add Spam Account nav item
if (bp_current_user_can('bp_moderate')) {
$sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
}
// Add Delete Account nav item
if (!bp_disable_account_deletion() || bp_current_user_can('delete_users')) {
$sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() || !is_super_admin(bp_displayed_user_id()));
}
parent::setup_nav($main_nav, $sub_nav);
}
示例3: setup_nav
/**
* Set up navigation.
*
* @param array $main_nav Array of main nav items.
* @param array $sub_nav Array of sub nav items.
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
// Determine user to use
if (bp_displayed_user_domain()) {
$user_domain = bp_displayed_user_domain();
} elseif (bp_loggedin_user_domain()) {
$user_domain = bp_loggedin_user_domain();
} else {
return;
}
$access = bp_core_can_edit_settings();
$slug = bp_get_settings_slug();
$settings_link = trailingslashit($user_domain . $slug);
// Add the settings navigation item
$main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $slug, 'position' => 100, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
// Add General Settings nav item
$sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => $access);
// Add Email nav item. Formerly called 'Notifications', we
// retain the old slug and function names for backward compat
$sub_nav[] = array('name' => __('Email', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => $access);
// Add Spam Account nav item
if (bp_current_user_can('bp_moderate')) {
$sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
}
// Add Delete Account nav item
if (!bp_disable_account_deletion() && bp_is_my_profile() || bp_current_user_can('delete_users')) {
$sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => !is_super_admin(bp_displayed_user_id()));
}
parent::setup_nav($main_nav, $sub_nav);
}
示例4: array
/**
* GMW Location menu tab
*/
function setup_nav($main_nav = array(), $sub_nav = array())
{
global $bp;
// Add 'location' to the main navigation
$main_nav = apply_filters('gmw_fl_setup_nav', array('name' => __('Location', 'GMW'), 'slug' => GMW_FL_SLUG, 'position' => 60, 'screen_function' => array($this, 'screen_functions'), 'default_subnav_slug' => GMW_FL_SLUG), $bp->displayed_user);
$user_domain = !empty($bp->displayed_user->id) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
$gmw_location_link = trailingslashit($user_domain . GMW_FL_SLUG);
parent::setup_nav($main_nav);
}
示例5: array
/**
* Set up navigation
*
* @since 1.3
*/
function setup_nav($main_nav = array(), $sub_nav = array())
{
// Add 'Example' to the main navigation
$main_nav = array('name' => __('Projects', 'collabpress'), 'slug' => $this->slug, 'position' => 44, 'screen_function' => array($this, 'template_loader'), 'default_subnav_slug' => 'tasks', 'show_for_displayed_user' => array($this, 'show_tab_for_current_user'));
$projects_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
// Add a few subnav items under the main Example tab
$sub_nav[] = array('name' => bp_is_my_profile() ? __('My Tasks', 'collabpress') : sprintf(__('%s’s Tasks', 'collabpress'), bp_get_user_firstname()), 'slug' => 'tasks', 'parent_url' => $projects_link, 'parent_slug' => $this->slug, 'screen_function' => array($this, 'template_loader'), 'position' => 10);
parent::setup_nav($main_nav, $sub_nav);
}
示例6: array
/**
* Setup BuddyBar navigation
*
* @global obj $bp
*/
function setup_nav()
{
global $bp;
// Add 'Friends' to the main navigation
$main_nav = array('name' => sprintf(__('Friends <span>%d</span>', 'buddypress'), friends_get_total_friend_count()), 'slug' => $this->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id);
$friends_link = trailingslashit($bp->loggedin_user->domain . bp_get_friends_slug());
// Add the subnav items to the friends nav item
$sub_nav[] = array('name' => __('Friendships', 'buddypress'), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends');
$sub_nav[] = array('name' => __('Requests', 'buddypress'), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => bp_is_my_profile());
parent::setup_nav($main_nav, $sub_nav);
}
示例7: array
/**
* Set up the navigation.
*
* @since 1.0.0
* @access public
*
* @param array $main_nav Optional. See BP_Component::setup_nav().
* @param array $sub_nav Optional. See BP_Component::setup_nav().
*/
function setup_nav($main_nav = array(), $sub_nav = array())
{
$count = Mute::get_count(bp_displayed_user_id());
$class = $count === 0 ? 'no-count' : 'count';
$main_nav = array('name' => sprintf(__('Mute <span class="%s">%s</span>', 'buddypress-mute'), esc_attr($class), number_format_i18n($count)), 'position' => 80, 'default_subnav_slug' => 'all', 'slug' => $this->slug, 'item_css_id' => $this->id, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_all_screen');
$sub_nav[] = array('name' => __('All', 'buddypress-mute'), 'slug' => 'all', 'position' => 10, 'parent_slug' => $this->slug, 'parent_url' => trailingslashit(bp_displayed_user_domain() . $this->slug), 'user_has_access' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_all_screen');
if (bp_is_active('friends')) {
$sub_nav[] = array('name' => __('Friends', 'buddypress-mute'), 'slug' => 'friends', 'position' => 20, 'parent_slug' => $this->slug, 'parent_url' => trailingslashit(bp_displayed_user_domain() . $this->slug), 'user_has_access' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_friends_screen');
}
parent::setup_nav($main_nav, $sub_nav);
}
示例8: setup_nav
/**
* Set the component's navigation
*/
public function setup_nav()
{
// Main navigation
$main_nav = array('name' => sprintf(__('Projects <span>%s</span>', 'bp-portfolio'), bp_portfolio_get_user_projects_count(bp_displayed_user_id())), 'slug' => bp_get_portfolio_slug(), 'position' => 80, 'screen_function' => 'bp_portfolio_screen_personal', 'default_subnav_slug' => 'personal');
$portfolio_link = trailingslashit(bp_loggedin_user_domain() . bp_get_portfolio_slug());
// Add a few subnav items under the main Portfolio tab
$sub_nav[] = array('name' => __('Personal', 'bp-portfolio'), 'slug' => 'personal', 'parent_url' => $portfolio_link, 'parent_slug' => bp_get_portfolio_slug(), 'screen_function' => 'bp_portfolio_screen_personal', 'position' => 10);
if (bp_displayed_user_id() == bp_loggedin_user_id()) {
// Add a few subnav items under the main Portfolio tab
$sub_nav[] = array('name' => __('Add', 'bp-portfolio'), 'slug' => 'add', 'parent_url' => $portfolio_link, 'parent_slug' => bp_get_portfolio_slug(), 'screen_function' => 'bp_portfolio_screen_add', 'position' => 20);
}
parent::setup_nav($main_nav, $sub_nav);
}
示例9: array
/**
* Setup BuddyBar navigation
*
* @global obj $bp
*/
function setup_nav()
{
global $bp;
// Add 'Profile' to the main navigation
$main_nav = array('name' => __('Profile', 'buddypress'), 'slug' => $this->slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $this->id);
$profile_link = trailingslashit($bp->loggedin_user->domain . $this->slug);
// Add the subnav items to the profile
$sub_nav[] = array('name' => __('Public', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10);
// Edit Profile
$sub_nav[] = array('name' => __('Edit', 'buddypress'), 'slug' => 'edit', 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => 'xprofile_screen_edit_profile', 'position' => 20);
// Change Avatar
$sub_nav[] = array('name' => __('Change Avatar', 'buddypress'), 'slug' => 'change-avatar', 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => 'xprofile_screen_change_avatar', 'position' => 30);
parent::setup_nav($main_nav, $sub_nav);
}
示例10: array
/**
* Setup BuddyBar navigation
*
* @global obj $bp
*/
function setup_nav()
{
global $bp;
/**
* Blog/post/comment menus should not appear on single WordPress setups.
* Although comments and posts made by users will still show on their
* activity stream.
*/
if (!is_multisite()) {
return false;
}
// Add 'Sites' to the main navigation
$main_nav = array('name' => sprintf(__('Sites <span>%d</span>', 'buddypress'), bp_blogs_total_blogs_for_user()), 'slug' => $this->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $this->id);
// Setup navigation
parent::setup_nav($main_nav);
}
示例11: setup_nav
/**
* Set up component navigation, and register display callbacks.
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
// Only grab count if we're on a user page.
$count = 0;
if (bp_is_user()) {
$count = $this->humcore_get_user_deposit_count();
}
$class = 0 === $count ? 'no-count' : 'count';
$nav_name = sprintf(__('Deposits <span class="%s">%s</span>', 'humcore_domain'), esc_attr($class), number_format_i18n($count));
$main_nav = array('name' => $nav_name, 'slug' => $this->slug, 'position' => 35, 'default_subnav_slug' => 'my-deposits', 'screen_function' => array($this, 'screen_function'));
/** BuddyPress needs to have at least one subnav item, even if
* it's redundant
*/
$sub_nav[] = array('name' => __('Deposits', 'humcore_domain'), 'slug' => 'my-deposits', 'parent_slug' => 'deposits', 'parent_url' => bp_displayed_user_domain() . 'deposits/');
parent::setup_nav($main_nav, $sub_nav);
}
示例12: sprintf
/**
* Setup BuddyBar navigation
*
* @global obj $bp
*/
function setup_nav()
{
global $bp;
$name = sprintf(__('Messages <span>%s</span>', 'buddypress'), bp_get_total_unread_messages_count());
// Add 'Messages' to the main navigation
$main_nav = array('name' => $name, 'slug' => $this->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $this->id);
// Link to user messages
$messages_link = trailingslashit($bp->loggedin_user->domain . $this->slug);
// Add the subnav items to the profile
$sub_nav[] = array('name' => __('Inbox', 'buddypress'), 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_is_my_profile());
$sub_nav[] = array('name' => __('Sent', 'buddypress'), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_is_my_profile());
$sub_nav[] = array('name' => __('Compose', 'buddypress'), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_is_my_profile());
if (is_super_admin()) {
$sub_nav[] = array('name' => __('Notices', 'buddypress'), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_super_admin());
}
parent::setup_nav($main_nav, $sub_nav);
}
示例13: array
/**
* Set up bp-checkins navigation.
*/
function setup_nav()
{
global $bp;
// Add 'Checkins' to the main navigation
$main_nav = array('name' => __('Checkins', 'bp-checkins'), 'slug' => BP_CHECKINS_SLUG, 'position' => 80, 'screen_function' => 'bp_checkins_my_checkins', 'default_subnav_slug' => 'checkins-area');
$user_domain = !empty($bp->displayed_user->id) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
$checkins_link = trailingslashit($user_domain . BP_CHECKINS_SLUG);
// Add a few subnav items under the main Example tab
$sub_nav[] = array('name' => __('Checkins', 'bp-checkins'), 'slug' => 'checkins-area', 'parent_url' => $checkins_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_checkins_my_checkins', 'position' => 10);
// Add the subnav items to the friends nav item
$sub_nav[] = array('name' => __('Places', 'bp-checkins'), 'slug' => 'places-area', 'parent_url' => $checkins_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_checkins_my_places', 'position' => 20);
parent::setup_nav($main_nav, $sub_nav);
if (bp_checkins_is_foursquare_ready() && bp_is_active('settings')) {
// Member Settings tab
bp_core_new_subnav_item(array('name' => __('Checkins settings', 'bp-checkins'), 'slug' => 'checkins-settings', 'parent_slug' => bp_get_settings_slug(), 'parent_url' => trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()), 'screen_function' => 'bp_checkins_screen_settings_menu', 'position' => 40, 'user_has_access' => bp_is_my_profile()));
}
}
示例14: setup_nav
/**
* Setup BuddyBar navigation
*
* @global BuddyPress $bp The one true BuddyPress instance
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
global $bp;
$sub_nav = array();
// Add 'Friends' to the main navigation
$main_nav = array('name' => sprintf(__('Friends <span>%d</span>', 'buddypress'), friends_get_total_friend_count()), 'slug' => $this->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id);
// Determine user to use
if (bp_displayed_user_domain()) {
$user_domain = bp_displayed_user_domain();
} elseif (bp_loggedin_user_domain()) {
$user_domain = bp_loggedin_user_domain();
} else {
return;
}
$friends_link = trailingslashit($user_domain . bp_get_friends_slug());
// Add the subnav items to the friends nav item
$sub_nav[] = array('name' => __('Friendships', 'buddypress'), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends');
$sub_nav[] = array('name' => __('Requests', 'buddypress'), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
parent::setup_nav($main_nav, $sub_nav);
}
示例15: array
function setup_nav()
{
global $blog_id;
//check multisite or normal mode for correct permission checking
if (is_multisite() && $blog_id != BP_ROOT_BLOG) {
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
$current_blog = $blog_id;
switch_to_blog(BP_ROOT_BLOG);
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
switch_to_blog($current_blog);
} else {
$can_manage_events = current_user_can('edit_events');
$can_manage_locations = current_user_can('edit_locations');
$can_manage_bookings = current_user_can('manage_bookings');
}
/* Add 'Events' to the main user profile navigation */
$main_nav = array('name' => __('Events', 'dbem'), 'slug' => em_bp_get_slug(), 'position' => 80, 'screen_function' => 'bp_em_events', 'default_subnav_slug' => 'profile');
$em_link = trailingslashit(bp_loggedin_user_domain() . em_bp_get_slug());
/* Create SubNav Items */
$sub_nav[] = array('name' => __('My Profile', 'dbem'), 'slug' => 'profile', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_events', 'position' => 10);
$sub_nav[] = array('name' => __('Events I\'m Attending', 'dbem'), 'slug' => 'attending', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_attending', 'position' => 20, 'user_has_access' => bp_is_my_profile());
if ($can_manage_events) {
$sub_nav[] = array('name' => __('My Events', 'dbem'), 'slug' => 'my-events', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_events', 'position' => 30, 'user_has_access' => bp_is_my_profile());
}
if ($can_manage_locations && get_option('dbem_locations_enabled')) {
$sub_nav[] = array('name' => __('My Locations', 'dbem'), 'slug' => 'my-locations', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_locations', 'position' => 40, 'user_has_access' => bp_is_my_profile());
}
if ($can_manage_bookings && get_option('dbem_rsvp_enabled')) {
$sub_nav[] = array('name' => __('My Event Bookings', 'dbem'), 'slug' => 'my-bookings', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_bookings', 'position' => 50, 'user_has_access' => bp_is_my_profile());
}
if (bp_is_active('groups')) {
/* Create Profile Group Sub-Nav */
$sub_nav[] = array('name' => __('Events', 'dbem'), 'slug' => 'group-events', 'parent_slug' => bp_get_groups_slug(), 'parent_url' => trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()), 'screen_function' => 'bp_em_my_group_events', 'position' => 60, 'user_has_access' => bp_is_my_profile());
}
parent::setup_nav($main_nav, $sub_nav);
add_action('bp_init', array(&$this, 'setup_group_nav'));
}