本文整理汇总了PHP中bp_displayed_user_domain函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_displayed_user_domain函数的具体用法?PHP bp_displayed_user_domain怎么用?PHP bp_displayed_user_domain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_displayed_user_domain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_members_admin_bar_user_admin_menu
/**
* Adds the User Admin top-level menu to user pages
*
* @package BuddyPress
* @since 1.5
*/
function bp_members_admin_bar_user_admin_menu()
{
global $bp, $wp_admin_bar;
// Only show if viewing a user
if (!bp_is_user()) {
return false;
}
// Don't show this menu to non site admins or if you're viewing your own profile
if (!current_user_can('edit_users') || bp_is_my_profile()) {
return false;
}
// User avatar
$avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'email' => $bp->displayed_user->userdata->user_email, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->user_admin_menu_id = !empty($avatar) ? 'user-admin-with-avatar' : 'user-admin';
// Add the top-level User Admin button
$wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => $avatar . bp_get_displayed_user_fullname(), 'href' => bp_displayed_user_domain()));
// User Admin > Edit this user's profile
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
// User Admin > Edit this user's avatar
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'change-avatar', 'title' => __("Edit Avatar", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
// User Admin > Spam/unspam
if (!bp_core_is_user_spammer(bp_displayed_user_id())) {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'spam-user', 'title' => __('Mark as Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as a spammer?', 'buddypress') . '");')));
} else {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'unspam-user', 'title' => __('Not a Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as not a spammer?', 'buddypress') . '");')));
}
// User Admin > Delete Account
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user'), 'meta' => array('onclick' => 'confirm(" ' . __("Are you sure you want to delete this user's account?", 'buddypress') . '");')));
}
示例2: 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');
}
示例3: setup_nav
function setup_nav()
{
global $bp;
$link = bp_displayed_user_id() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
$reshare_nav = array('name' => __('Reshares', 'bp-reshare'), 'link' => $link . bp_get_activity_slug() . '/reshares/', 'slug' => 'reshares', 'css_id' => 'activity-reshares', 'user_has_access' => true, 'position' => 50, 'screen_function' => false);
$bp->bp_options_nav['activity']['reshares'] = $reshare_nav;
}
示例4: 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;
/**
* 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;
}
$sub_nav = array();
// 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-sites', 'item_css_id' => $this->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;
}
$parent_url = trailingslashit($user_domain . bp_get_blogs_slug());
$sub_nav[] = array('name' => __('My Sites', 'buddypress'), 'slug' => 'my-sites', 'parent_url' => $parent_url, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_my_blogs', 'position' => 10);
// Setup navigation
parent::setup_nav($main_nav, $sub_nav);
}
示例5: setup_nav
/**
* Set up component navigation.
*
* @since 1.9.0
*
* @see BP_Component::setup_nav() for a description of arguments.
*
* @param array $main_nav Optional. See BP_Component::setup_nav() for
* description.
* @param array $sub_nav Optional. See BP_Component::setup_nav() for
* description.
*/
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_notifications_slug();
$notifications_link = trailingslashit($user_domain . $slug);
// Only grab count if we're on a user page and current user has access.
if (bp_is_user() && bp_user_has_access()) {
$count = bp_notifications_get_unread_notification_count(bp_displayed_user_id());
$class = 0 === $count ? 'no-count' : 'count';
$nav_name = sprintf(_x('Notifications <span class="%s">%s</span>', 'Profile screen nav', 'buddypress'), esc_attr($class), bp_core_number_format($count));
} else {
$nav_name = _x('Notifications', 'Profile screen nav', 'buddypress');
}
// Add 'Notifications' to the main navigation.
$main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 30, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_notifications_screen_unread', 'default_subnav_slug' => 'unread', 'item_css_id' => $this->id);
// Add the subnav items to the notifications nav item.
$sub_nav[] = array('name' => _x('Unread', 'Notification screen nav', 'buddypress'), 'slug' => 'unread', 'parent_url' => $notifications_link, 'parent_slug' => $slug, 'screen_function' => 'bp_notifications_screen_unread', 'position' => 10, 'item_css_id' => 'notifications-my-notifications', 'user_has_access' => $access);
$sub_nav[] = array('name' => _x('Read', 'Notification screen nav', 'buddypress'), 'slug' => 'read', 'parent_url' => $notifications_link, 'parent_slug' => $slug, 'screen_function' => 'bp_notifications_screen_read', 'position' => 20, 'user_has_access' => $access);
parent::setup_nav($main_nav, $sub_nav);
}
示例6: bp_members_admin_bar_user_admin_menu
/**
* Add the User Admin top-level menu to user pages.
*
* @since 1.5.0
*/
function bp_members_admin_bar_user_admin_menu()
{
global $wp_admin_bar;
// Only show if viewing a user
if (!bp_is_user()) {
return false;
}
// Don't show this menu to non site admins or if you're viewing your own profile
if (!current_user_can('edit_users') || bp_is_my_profile()) {
return false;
}
$bp = buddypress();
// Unique ID for the 'My Account' menu
$bp->user_admin_menu_id = 'user-admin';
// Add the top-level User Admin button
$wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => __('Edit Member', 'buddypress'), 'href' => bp_displayed_user_domain()));
if (bp_is_active('xprofile')) {
// User Admin > Edit this user's profile
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
// User Admin > Edit this user's avatar
if (buddypress()->avatar->show_avatars) {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-change-avatar', 'title' => __("Edit Profile Photo", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
}
}
if (bp_is_active('settings')) {
// User Admin > Spam/unspam
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-user-capabilities', 'title' => __('User Capabilities', 'buddypress'), 'href' => bp_displayed_user_domain() . 'settings/capabilities/'));
// User Admin > Delete Account
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => bp_displayed_user_domain() . 'settings/delete-account/'));
}
}
示例7: setup_nav
/**
* 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: setup_nav
/**
* Setup BuddyBar navigation
*
* @global BuddyPress $bp The one true BuddyPress instance
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
$sub_nav = array();
$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);
// 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;
}
// Link to user messages
$messages_link = trailingslashit($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_core_can_edit_settings());
$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_core_can_edit_settings());
$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_core_can_edit_settings());
if (bp_current_user_can('bp_moderate')) {
$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' => bp_current_user_can('bp_moderate'));
}
parent::setup_nav($main_nav, $sub_nav);
}
示例11: setup_nav
public function setup_nav($main = array(), $sub = array())
{
$bp = buddypress();
$component = 'members';
$component_id = mpp_get_current_component_id();
if (!mpp_is_enabled($component, $component_id)) {
//allow to disable user galleries in case they don't want it
return false;
}
$view_helper = MPP_Gallery_Screens::get_instance();
// Add 'Gallery' to the user's main navigation
$main_nav = array('name' => sprintf(__('Gallery <span>%d</span>', 'mediapress'), mpp_get_total_gallery_for_user()), 'slug' => $this->slug, 'position' => 86, 'screen_function' => array($view_helper, 'user_galleries'), 'default_subnav_slug' => 'my-galleries', 'item_css_id' => $this->id);
if (bp_is_user()) {
$user_domain = bp_displayed_user_domain();
} else {
$user_domain = bp_loggedin_user_domain();
}
$gallery_link = trailingslashit($user_domain . $this->slug);
//with a trailing slash
// Add the My Gallery nav item
$sub_nav[] = array('name' => __('My Gallery', 'mediapress'), 'slug' => 'my-galleries', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 10, 'item_css_id' => 'gallery-my-gallery');
if (mpp_user_can_create_gallery($component, get_current_user_id())) {
// Add the Create gallery link to gallery nav
$sub_nav[] = array('name' => __('Create a Gallery', 'mediapress'), 'slug' => 'create', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'user_has_access' => bp_is_my_profile(), 'position' => 20);
}
if (mpp_component_has_type_filters_enabled($component, $component_id)) {
$i = 10;
$supported_types = mpp_component_get_supported_types($component);
foreach ($supported_types as $type) {
if (!mpp_is_active_type($type)) {
continue;
}
$type_object = mpp_get_type_object($type);
$sub_nav[] = array('name' => $type_object->label, 'slug' => 'type/' . $type, 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 20 + $i);
$i = $i + 10;
//increment the position
}
}
// Add the Upload link to gallery nav
/*$sub_nav[] = array(
'name' => __( 'Upload', 'mediapress'),
'slug' => 'upload',
'parent_url' => $gallery_link,
'parent_slug' => $this->slug,
'screen_function' => array( $view_helper, 'upload_media' ),
'user_has_access' => bp_is_my_profile(),
'position' => 30
);*/
parent::setup_nav($main_nav, $sub_nav);
//disallow these names in various lists
//we have yet to implement it
$this->forbidden_names = apply_filters('mpp_forbidden_names', array('gallery', 'galleries', 'my-gallery', 'create', 'delete', 'upload', 'add', 'edit', 'admin', 'request', 'upload', 'tags', 'audio', 'video', 'photo'));
//use this to extend the valid status
$this->valid_status = apply_filters('mpp_valid_gallery_status', array_keys(mpp_get_active_statuses()));
do_action('mpp_setup_nav');
// $bp->gallery->current_gallery->user_has_access
}
示例12: bebop_get_feed_url
function bebop_get_feed_url()
{
global $this_bp_feed;
if (!empty($this_bp_feed)) {
return bp_displayed_user_domain() . bp_get_activity_slug() . '/' . $this_bp_feed;
} else {
return false;
}
}
示例13: bp_profile_submenu_posts
/**
* Build two sub menu items, the first is showing by default
* @author Nacho Abejaro
*/
function bp_profile_submenu_posts()
{
global $bp;
$publishCount = get_user_posts_count('publish');
$pendingCount = get_user_posts_count('pending');
$draftCount = get_user_posts_count('draft');
bp_core_new_subnav_item(array('name' => __('Published', 'agora-functions') . '<span>' . $publishCount . '</span>', 'slug' => 'mypublished', 'parent_url' => bp_displayed_user_domain() . $bp->bp_nav['myposts']['slug'] . '/', 'parent_slug' => $bp->bp_nav['myposts']['slug'], 'position' => 10, 'screen_function' => 'mb_author_posts'));
bp_core_new_subnav_item(array('name' => __('Pending Review', 'agora-functions') . '<span>' . $pendingCount . '</span>', 'slug' => 'myunder-review', 'parent_url' => bp_displayed_user_domain() . $bp->bp_nav['myposts']['slug'] . '/', 'parent_slug' => $bp->bp_nav['myposts']['slug'], 'position' => 20, 'screen_function' => 'mb_author_pending'));
bp_core_new_subnav_item(array('name' => __('Drafts', 'agora-functions') . '<span>' . $draftCount . '</span>', 'slug' => 'mydrafts', 'parent_url' => bp_displayed_user_domain() . $bp->bp_nav['myposts']['slug'] . '/', 'parent_slug' => $bp->bp_nav['myposts']['slug'], 'position' => 30, 'screen_function' => 'mb_author_drafts'));
}
示例14: setup_nav
/**
* 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);
}
示例15: 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);
}