本文整理汇总了PHP中BP_Component::setup_admin_bar方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Component::setup_admin_bar方法的具体用法?PHP BP_Component::setup_admin_bar怎么用?PHP BP_Component::setup_admin_bar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Component
的用法示例。
在下文中一共展示了BP_Component::setup_admin_bar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function setup_admin_bar($wp_admin_nav = array())
{
global $bp;
$directWorkflow = isDirectWorkflow();
if (is_user_logged_in()) {
if ($directWorkflow) {
$postCount = custom_get_user_posts_count(array("publish", "draft"));
} else {
$postCount = custom_get_user_posts_count(array("publish", "pending", "draft"));
}
$user_domain = bp_loggedin_user_domain();
$wp_admin_nav[] = array('parent' => 'my-account-buddypress', 'id' => 'my-account-social-articles', 'title' => __('Social Articles', 'social-articles'), 'href' => trailingslashit($user_domain . 'articles'));
$wp_admin_nav[] = array('parent' => 'my-account-social-articles', 'title' => sprintf(__('My Articles <span class="count">%d</span>', 'social-articles'), $postCount), 'href' => trailingslashit($user_domain . 'articles'));
$wp_admin_nav[] = array('parent' => 'my-account-social-articles', 'title' => sprintf(__('New Article', 'social-articles')), 'href' => trailingslashit($user_domain . 'articles/new'));
}
if ($this->check_visibility()) {
parent::setup_admin_bar($wp_admin_nav);
}
}
示例2: setup_admin_bar
/**
* Add an "achievements" item to the Toolbar "profile" submenu (which is added by BuddyPress).
*
* @param string|array $wp_admin_menus Optional (not used in this function).
* @since Achievements (3.2)
*/
public function setup_admin_bar($wp_admin_nav = '')
{
$wp_admin_nav = array();
// Add "achievements" menu under "profile"
if (is_user_logged_in()) {
$wp_admin_nav[] = array('href' => dpa_get_user_avatar_link(array('type' => 'url')), 'id' => 'my-account-' . $this->id . '-edit', 'parent' => 'my-account-xprofile', 'title' => __('Achievements', 'achievements'));
}
parent::setup_admin_bar($wp_admin_nav);
}
示例3: setup_admin_bar
/**
* Sets up Docs menu under My Account toolbar
*
* @since 1.3
*/
public function setup_admin_bar($wp_admin_nav = array())
{
global $bp;
$wp_admin_nav = array();
if (is_user_logged_in()) {
$title = bp_docs_get_user_tab_name();
// Add the "My Account" sub menus
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => bp_docs_get_mydocs_link());
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-started', 'title' => __('Started By Me', 'bp-docs'), 'href' => bp_docs_get_mydocs_started_link());
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-edited', 'title' => __('Edited By Me', 'bp-docs'), 'href' => bp_docs_get_mydocs_edited_link());
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => __('Create New Doc', 'bp-docs'), 'href' => bp_docs_get_create_link());
}
parent::setup_admin_bar($wp_admin_nav);
}
示例4: setup_admin_bar
/**
* Set up bp-friends integration with the WordPress admin bar.
*
* @since 1.5.0
*
* @see BP_Component::setup_admin_bar() for a description of arguments.
*
* @param array $wp_admin_nav See BP_Component::setup_admin_bar()
* for description.
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user.
if (is_user_logged_in()) {
// Setup the logged in user variables.
$friends_link = trailingslashit(bp_loggedin_user_domain() . bp_get_friends_slug());
// Pending friend requests.
$count = count(friends_get_friendship_request_user_ids(bp_loggedin_user_id()));
if (!empty($count)) {
$title = sprintf(_x('Friends <span class="count">%s</span>', 'My Account Friends menu', 'buddypress'), bp_core_number_format($count));
$pending = sprintf(_x('Pending Requests <span class="count">%s</span>', 'My Account Friends menu sub nav', 'buddypress'), bp_core_number_format($count));
} else {
$title = _x('Friends', 'My Account Friends menu', 'buddypress');
$pending = _x('No Pending Requests', 'My Account Friends menu sub nav', 'buddypress');
}
// Add the "My Account" sub menus.
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $friends_link);
// My Friends.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friendships', 'title' => _x('Friendships', 'My Account Friends menu sub nav', 'buddypress'), 'href' => $friends_link, 'position' => 10);
// Requests.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-requests', 'title' => $pending, 'href' => trailingslashit($friends_link . 'requests'), 'position' => 20);
}
parent::setup_admin_bar($wp_admin_nav);
}
示例5: array
/**
* Set up the admin bar
*
* @global obj $bp
*/
function setup_admin_bar()
{
global $bp;
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = $bp->loggedin_user->domain;
$user_login = $bp->loggedin_user->userdata->user_login;
$forums_link = trailingslashit($user_domain . $this->slug);
// Add the "My Account" sub menus
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Forums', 'buddypress'), 'href' => trailingslashit($forums_link));
// Topics
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-topics-started', 'title' => __('Topics Started', 'buddypress'), 'href' => trailingslashit($forums_link . 'topics'));
// Replies
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-replies', 'title' => __('Replies', 'buddypress'), 'href' => trailingslashit($forums_link . 'replies'));
// Favorites
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorite-topics', 'title' => __('Favorite Topics', 'buddypress'), 'href' => trailingslashit($forums_link . 'favorites'));
}
parent::setup_admin_bar($wp_admin_nav);
}
示例6: setup_admin_bar
/**
* Set up the component entries in the WordPress Admin Bar.
*
* @see BP_Component::setup_nav() for a description of the $wp_admin_nav
* parameter array.
*
* @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a description.
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user.
if (is_user_logged_in()) {
// Setup the logged in user variables.
$groups_link = trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug());
// Pending group invites.
$count = groups_get_invite_count_for_user();
$title = _x('Groups', 'My Account Groups', 'buddypress');
$pending = _x('No Pending Invites', 'My Account Groups sub nav', 'buddypress');
if (!empty($count['total'])) {
$title = sprintf(_x('Groups <span class="count">%s</span>', 'My Account Groups nav', 'buddypress'), bp_core_number_format($count));
$pending = sprintf(_x('Pending Invites <span class="count">%s</span>', 'My Account Groups sub nav', 'buddypress'), bp_core_number_format($count));
}
// Add the "My Account" sub menus.
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $groups_link);
// My Groups.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-memberships', 'title' => _x('Memberships', 'My Account Groups sub nav', 'buddypress'), 'href' => $groups_link);
// Invitations.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-invites', 'title' => $pending, 'href' => trailingslashit($groups_link . 'invites'));
// Create a Group.
if (bp_user_can_create_groups()) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => _x('Create a Group', 'My Account Groups sub nav', 'buddypress'), 'href' => trailingslashit(bp_get_groups_directory_permalink() . 'create'));
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例7: setup_admin_bar
/**
* Set up the Toolbar.
*
* @param array $wp_admin_nav See {BP_Component::setup_admin_bar()}
* for details.
*/
public function setup_admin_bar($wp_admin_nav = array())
{
$bp = buddypress();
// Menus for logged in user if the members gallery is enabled
if (is_user_logged_in() && mpp_is_enabled('members', bp_loggedin_user_id())) {
$component = 'members';
$component_id = get_current_user_id();
$gallery_link = trailingslashit(mpp_get_gallery_base_url($component, $component_id));
$title = __('Gallery', 'mediapress');
$my_galleries = __('My Gallery', 'mediapress');
$create = __('Create', 'mediapress');
// Add main mediapress menu
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => trailingslashit($gallery_link));
// Add main mediapress menu
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-my-galleries', 'title' => $my_galleries, 'href' => trailingslashit($gallery_link));
if (mpp_user_can_create_gallery($component, $component_id)) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => $create, 'href' => mpp_get_gallery_create_url($component, $component_id));
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例8: setup_admin_bar
/**
* Set up the component entries in the WordPress Admin Bar.
*
* @since BuddyPress (1.5)
*
* @see BP_Component::setup_nav() for a description of the $wp_admin_nav
* parameter array.
* @uses is_user_logged_in()
* @uses trailingslashit()
* @uses bp_get_total_mention_count_for_user()
* @uses bp_loggedin_user_id()
* @uses bp_is_active()
* @uses bp_get_friends_slug()
* @uses bp_get_groups_slug()
*
* @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
* description.
*/
public function setup_admin_bar($wp_admin_nav = array())
{
$bp = buddypress();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = bp_loggedin_user_domain();
$activity_link = trailingslashit($user_domain . $this->slug);
// Unread message count
if (bp_activity_do_mentions()) {
$count = bp_get_total_mention_count_for_user(bp_loggedin_user_id());
if (!empty($count)) {
$title = sprintf(__('Mentions <span class="count">%s</span>', 'buddypress'), number_format_i18n($count));
} else {
$title = __('Mentions', 'buddypress');
}
}
// Add the "Activity" sub menu
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Activity', 'buddypress'), 'href' => trailingslashit($activity_link));
// Personal
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => __('Personal', 'buddypress'), 'href' => trailingslashit($activity_link));
// Mentions
if (bp_activity_do_mentions()) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => trailingslashit($activity_link . 'mentions'));
}
// Favorites
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => __('Favorites', 'buddypress'), 'href' => trailingslashit($activity_link . 'favorites'));
// Friends?
if (bp_is_active('friends')) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => __('Friends', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_friends_slug()));
}
// Groups?
if (bp_is_active('groups')) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => __('Groups', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_groups_slug()));
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例9: setup_admin_bar
/**
* Set up the admin bar
*
* @since bbPress (r3552)
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = bp_loggedin_user_domain();
$forums_link = trailingslashit($user_domain . $this->slug);
// Add the "My Account" sub menus
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Forums', 'bbpress'), 'href' => trailingslashit($forums_link));
// Topics
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-topics', 'title' => __('Topics Started', 'bbpress'), 'href' => trailingslashit($forums_link . bbp_get_topic_archive_slug()));
// Replies
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-replies', 'title' => __('Replies Created', 'bbpress'), 'href' => trailingslashit($forums_link . bbp_get_reply_archive_slug()));
// Favorites
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => __('Favorite Topics', 'bbpress'), 'href' => trailingslashit($forums_link . bbp_get_user_favorites_slug()));
// Subscriptions
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-subscriptions', 'title' => __('Subscribed Topics', 'bbpress'), 'href' => trailingslashit($forums_link . bbp_get_user_subscriptions_slug()));
}
parent::setup_admin_bar($wp_admin_nav);
}
示例10: array
/**
* Set up the admin bar
*
* @global obj $bp
*/
function setup_admin_bar()
{
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;
}
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
$blogs_link = trailingslashit($bp->loggedin_user->domain . $this->slug);
// Add the "Blogs" sub menu
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Sites', 'buddypress'), 'href' => trailingslashit($blogs_link));
// My Blogs
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'title' => __('My Sites', 'buddypress'), 'href' => trailingslashit($blogs_link));
}
parent::setup_admin_bar($wp_admin_nav);
}
示例11: setup_admin_bar
/**
* Set up the component entries in the WordPress Admin Bar.
*
* @package Rendez_Vous
* @subpackage Component
*
* @since Rendez Vous (1.0.0)
*/
public function setup_admin_bar($wp_admin_nav = array())
{
$bp = buddypress();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = bp_loggedin_user_domain();
$rendez_vous_link = trailingslashit($user_domain . $this->slug);
// Add the "Example" sub menu
$wp_admin_nav[0] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Rendez-vous', 'rendez-vous'), 'href' => trailingslashit($rendez_vous_link));
// Personal
$wp_admin_nav[$this->subnav_position['schedule']] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-schedule', 'title' => __('Schedule', 'rendez-vous'), 'href' => trailingslashit($rendez_vous_link . rendez_vous()->get_schedule_slug()));
// Screen two
$wp_admin_nav[$this->subnav_position['attend']] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-attend', 'title' => __('Attend', 'rendez-vous'), 'href' => trailingslashit($rendez_vous_link . rendez_vous()->get_attend_slug()));
// Sort WP Admin Nav
ksort($wp_admin_nav);
}
parent::setup_admin_bar($wp_admin_nav);
}
示例12: array
/**
* GMW location admin bar
* @see BP_Component::setup_admin_bar()
*/
function setup_admin_bar($wp_admin_nav = array())
{
global $bp;
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$gmw_location_link = trailingslashit(bp_loggedin_user_domain() . GMW_FL_SLUG);
// Add location tab
$wp_admin_nav[] = apply_filters('gmw_fl_setup_admin_bar', array('parent' => 'my-account-buddypress', 'id' => 'my-account-' . GMW_FL_SLUG, 'title' => __('Location', 'GMW'), 'href' => trailingslashit($gmw_location_link)));
// Add main bp checkins my places submenu
$wp_admin_nav[] = array('parent' => 'my-account-' . GMW_FL_SLUG, 'id' => 'my-account-' . GMW_FL_SLUG . '-gmw-location', 'title' => __('Update Location', 'GMW'), 'href' => trailingslashit($gmw_location_link));
}
parent::setup_admin_bar($wp_admin_nav);
}
示例13: setup_admin_bar
/**
* Set up the admin bar
*
* @since 2.1.0 bbPress (r3552)
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user
if (is_user_logged_in()) {
// If BuddyPress is network activated and bbPress is
// not activated on a the root blog but on any child one
if (!bp_is_root_blog()) {
$user_id = bbp_get_current_user_id();
$my_account_link = bbp_get_user_profile_url($user_id);
$my_topics_link = bbp_get_user_topics_created_url($user_id);
$my_replies_link = bbp_get_user_replies_created_url($user_id);
$my_favorites_link = bbp_get_favorites_permalink($user_id);
$my_subscriptions_link = bbp_get_subscriptions_permalink($user_id);
} else {
// Setup the logged in user variables
$user_domain = bp_loggedin_user_domain();
$forums_link = trailingslashit($user_domain . $this->slug);
$my_account_link = trailingslashit($forums_link);
$my_topics_link = trailingslashit($forums_link . bbp_get_topic_archive_slug());
$my_replies_link = trailingslashit($forums_link . bbp_get_reply_archive_slug());
$my_favorites_link = trailingslashit($forums_link . bbp_get_user_favorites_slug());
$my_subscriptions_link = trailingslashit($forums_link . bbp_get_user_subscriptions_slug());
}
// Add the "My Account" sub menus
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Forums', 'bbpress'), 'href' => $my_account_link);
// Topics
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-topics', 'title' => __('Topics Started', 'bbpress'), 'href' => $my_topics_link);
// Replies
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-replies', 'title' => __('Replies Created', 'bbpress'), 'href' => $my_replies_link);
// Favorites
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => __('Favorite Topics', 'bbpress'), 'href' => $my_favorites_link);
// Subscriptions
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-subscriptions', 'title' => __('Subscribed Topics', 'bbpress'), 'href' => $my_subscriptions_link);
}
parent::setup_admin_bar($wp_admin_nav);
}
示例14: array
function setup_admin_bar()
{
global $bp;
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$checkins_link = trailingslashit(bp_loggedin_user_domain() . BP_CHECKINS_SLUG);
// Add main bp checkins menu
$wp_admin_nav[] = array('parent' => 'my-account-buddypress', 'id' => 'my-account-' . BP_CHECKINS_SLUG, 'title' => __('Checkins', 'bp-checkins'), 'href' => trailingslashit($checkins_link));
// Add main bp checkins my places submenu
$wp_admin_nav[] = array('parent' => 'my-account-' . BP_CHECKINS_SLUG, 'id' => 'my-account-' . BP_CHECKINS_SLUG . '-checkins', 'title' => __('My Checkins', 'bp-checkins'), 'href' => trailingslashit($checkins_link));
// Add main bp checkins my places submenu
$wp_admin_nav[] = array('parent' => 'my-account-' . BP_CHECKINS_SLUG, 'id' => 'my-account-' . BP_CHECKINS_SLUG . '-places', 'title' => __('My Places', 'bp-checkins'), 'href' => trailingslashit($checkins_link . 'places-area'));
if (bp_checkins_is_foursquare_ready() && bp_is_active('settings')) {
if (!function_exists('bp_get_settings_slug')) {
return;
}
// Add bp checkins settings submenu
$wp_admin_nav[] = array('parent' => 'my-account-settings-default', 'id' => 'my-account-settings-' . BP_CHECKINS_SLUG . '-foursquare', 'title' => __('Checkins', 'bp-checkins'), 'href' => trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug() . '/checkins-settings'));
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例15: setup_admin_bar
/**
* Set up the Toolbar
*
*
*/
public function setup_admin_bar($nav = array())
{
$bp = buddypress();
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = bp_loggedin_user_domain();
$blog_link = trailingslashit($user_domain . $this->slug);
$title = __('Posts', 'buddyblog');
// My Posts
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => trailingslashit($blog_link));
}
parent::setup_admin_bar($wp_admin_nav);
}