本文整理汇总了PHP中BP_Component类的典型用法代码示例。如果您正苦于以下问题:PHP BP_Component类的具体用法?PHP BP_Component怎么用?PHP BP_Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BP_Component类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setup_globals
function setup_globals()
{
global $bp;
// Defining the slug in this way makes it possible for site admins to override it
if (!defined('BUATP_SLUG')) {
define('BUATP_SLUG', $this->id);
}
// Set up the $globals array to be passed along to parent::setup_globals()
$globals = array('slug' => BUATP_SLUG, 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : BUATP_SLUG, 'has_directory' => true, 'notification_callback' => 'buatp_format_notifications', 'search_string' => __('Search Members...', 'buddypress'));
// Let BP_Component::setup_globals() do its work.
parent::setup_globals($globals);
}
开发者ID:jfeliweb,项目名称:BuddyPress-User-Account-Type,代码行数:12,代码来源:buatp-core-loader.php
示例2: 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);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:27,代码来源:mpp-bp-component.php
示例3: setup_nav
/**
* Set up component navigation.
*
* @since BuddyPress (1.5.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())
{
$bp = buddypress();
// If xprofile component is disabled, revert to WordPress profile
if (!bp_is_active('xprofile')) {
// Fallback values if xprofile is disabled
if (!isset($bp->core->profile)) {
$bp->core->profile = new stdClass();
}
$bp->core->profile->slug = 'profile';
$bp->active_components[$bp->core->profile->slug] = $bp->core->profile->slug;
// Add 'Profile' to the main navigation
$main_nav = array('name' => __('Profile', 'buddypress'), 'slug' => $bp->core->profile->slug, 'position' => 20, 'screen_function' => 'bp_core_catch_profile_uri', 'default_subnav_slug' => 'public');
$profile_link = trailingslashit(bp_loggedin_user_domain() . '/' . $bp->core->profile->slug);
// Add the subnav items to the profile
$sub_nav[] = array('name' => __('View', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $bp->core->profile->slug, 'screen_function' => 'bp_core_catch_profile_uri');
parent::setup_nav($main_nav, $sub_nav);
}
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:bp-core-loader.php
示例4: setup_globals
/**
* Setup globals.
*
* @since 0.0.1
* @package BuddyPress_Compliments
*
* @global object $bp BuddyPress instance.
* @param array $args Not being used.
*/
public function setup_globals($args = array())
{
global $bp;
// Set up the $globals array
$globals = array('notification_callback' => 'bp_compliments_format_notifications', 'global_tables' => array('table_name' => BP_COMPLIMENTS_TABLE));
// Let BP_Component::setup_globals() do its work.
parent::setup_globals($globals);
// register other globals since BP isn't really flexible enough to add it
// in the setup_globals() method
//
// would rather do away with this, but keeping it for backpat
$bp->compliments->compliments = new stdClass();
$bp->compliments->compliments->slug = constant('BP_COMPLIMENTS_SLUG');
// locally cache total count values for logged-in user
if (is_user_logged_in()) {
$bp->loggedin_user->total_compliment_counts = bp_compliments_total_counts(array('user_id' => bp_loggedin_user_id()));
}
// locally cache total count values for displayed user
if (bp_is_user() && bp_loggedin_user_id() != bp_displayed_user_id()) {
$bp->displayed_user->total_compliment_counts = bp_compliments_total_counts(array('user_id' => bp_displayed_user_id()));
}
}
开发者ID:kprajapatii,项目名称:buddypress-compliments,代码行数:31,代码来源:bp-compliments-core.php
示例5: array
/**
* Register the new post type "portfolio"
*/
function register_post_types()
{
$labels = array('name' => __('Projects', 'bp-portfolio'), 'singular' => __('Project', 'bp-portfolio'));
// Set up the argument array for register_post_type()
$args = array('label' => __('Projects', 'bp-portfolio'), 'labels' => $labels, 'public' => false, 'show_ui' => true, 'supports' => array('title'), 'rewrite' => TRUE, 'rewrite' => array('slug' => 'project', 'with_front' => FALSE));
register_post_type('portfolio', $args);
parent::register_post_types();
}
开发者ID:ncrocfer,项目名称:BP-Portfolio,代码行数:11,代码来源:bp-portfolio-loader.php
示例6: setup_globals
/**
* Setting up buddypress component properties
* This is an override
* @return void
*/
public function setup_globals($args = array())
{
if (!defined('BP_SITE_SUBSCRIBER_SLUG')) {
define('BP_SITE_SUBSCRIBER_SLUG', $this->id);
}
$args = array('slug' => BP_SITE_SUBSCRIBER_SLUG, 'has_directory' => false, 'notification_callback' => 'bp_site_subscriber_notification_format');
parent::setup_globals($args);
}
开发者ID:lakrisgubben,项目名称:BP-Site-Subscriber,代码行数:13,代码来源:notifier.php
示例7:
/**
* Plugin settings
*/
function __construct()
{
parent::start('bp_smp', __('BuddyPress Social Media Profiles', 'bp-smp'), BP_SMP_PLUGIN_DIR);
$this->setup_hooks();
if (is_super_admin() && (is_admin() || is_network_admin())) {
include BP_SMP_PLUGIN_DIR . 'includes/admin.php';
$this->admin = new BP_SMP_Admin();
}
}
开发者ID:rjbaniel,项目名称:bp-social-media-profiles,代码行数:12,代码来源:bp-social-media-profiles.php
示例8: 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);
}
开发者ID:clarkewd,项目名称:CollabPress,代码行数:14,代码来源:cp-bp.php
示例9: setup_actions
/**
* Set up actions necessary for the component.
*
* @since BuddyPress (1.6)
*/
public function setup_actions()
{
add_action('humcore_deposits_results_deposit_sub_types', array($this, 'humcore_deposits_results_deposit_sub_types'));
add_action('bp_before_directory_deposits_content', array($this, 'humcore_before_directory_deposits_content'));
add_action('humcore_deposits_list_entry_content', 'humcore_deposits_list_entry_content');
add_action('humcore_deposits_entry_content', 'humcore_deposits_entry_content');
add_action('humcore_deposit_item_content', 'humcore_deposit_item_content');
add_action('humcore_deposit_item_review_content', 'humcore_deposit_item_review_content');
add_action('bp_activity_filter_options', array($this, 'display_activity_actions'));
add_action('bp_member_activity_filter_options', array($this, 'display_activity_actions'));
add_action('bp_setup_nav', array($this, 'humcore_setup_deposit_group_nav'));
parent::setup_actions();
}
开发者ID:MartinPaulEve,项目名称:humcore,代码行数:18,代码来源:component-loader.php
示例10: setup_actions
/**
* SETUP ACTIONS
*
* @since BuddyBoss BMT 1.0
*/
public function setup_actions()
{
// Add body class
add_filter('body_class', array($this, 'body_class'));
add_action('bp_members_directory_member_types', array($this, 'bpt_members_directory'));
add_action('bp_pre_user_query_construct', array($this, 'bpt_members_query'), 1, 1);
//Check hide member is not checked in setting
$is_member_type_field_visible = buddyboss_bmt()->option('hide_member_type_field');
if (empty($is_member_type_field_visible)) {
add_action('bp_signup_profile_fields', array($this, 'bmt_member_type_option'));
}
// For welcome exp
if (function_exists('bwe_load_admin')) {
add_action('bwe_after_signup_profile_fields', array($this, 'bmt_member_type_option'));
}
add_action('admin_enqueue_scripts', array($this, 'bmt_member_type_admin_style'));
parent::setup_actions();
}
开发者ID:tvolmari,项目名称:hammydowns,代码行数:23,代码来源:bmt-class.php
示例11: 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);
}
}
开发者ID:Dannypid,项目名称:Tinymce-social-articles-1.8,代码行数:19,代码来源:social-articles-load.php
示例12: 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'));
}
开发者ID:rajankz,项目名称:webspace,代码行数:39,代码来源:bp-em-core.php
示例13: elseif
/**
* Sets up the title for pages and <title>
*
* @global obj $bp
*/
function setup_title()
{
global $bp;
if (bp_is_my_profile()) {
$bp->bp_options_title = __('You', 'buddypress');
} elseif (bp_is_user()) {
$bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb'));
$bp->bp_options_title = $bp->displayed_user->fullname;
}
parent::setup_title();
}
开发者ID:newington,项目名称:buddypress,代码行数:16,代码来源:bp-members-loader.php
示例14: array
/**
* Set-up our buddypress navigation which
* are accesible in members and groups nav
*
* @param array $main_nav The main navigation for groups.
* @param array $sub_nav The sub navigation of groups.
* @return void
*/
function setup_nav($main_nav = array(), $sub_nav = array())
{
$main_nav = array('name' => $this->name, 'slug' => $this->id, 'position' => 80, 'screen_function' => 'task_breaker_bp_projects_main_screen_function', 'default_subnav_slug' => 'all');
// Add a few subnav items under the main tab.
$sub_nav[] = array('name' => __('My Projects', 'task_breaker'), 'slug' => 'all', 'parent_url' => bp_loggedin_user_domain() . '' . $this->id . '/', 'parent_slug' => 'projects', 'screen_function' => 'task_breaker_bp_projects_main_screen_function', 'position' => 10);
// Edit subnav.
$sub_nav[] = array('name' => __('New Project', 'task_breaker'), 'slug' => 'new', 'parent_url' => bp_loggedin_user_domain() . '' . $this->id . '/', 'parent_slug' => 'projects', 'screen_function' => 'task_breaker_bp_projects_main_screen_function_new_project', 'position' => 10);
parent::setup_nav($main_nav, $sub_nav);
return;
}
开发者ID:codehaiku,项目名称:task-breaker,代码行数:18,代码来源:project-component.php
示例15: array
function setup_admin_bar()
{
global $bp, $blog_id;
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
//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');
}
$em_link = trailingslashit(bp_loggedin_user_domain() . em_bp_get_slug());
/* Add 'Events' to the main user profile navigation */
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-em-' . $this->id, 'title' => __('Events', 'dbem'), 'href' => $em_link);
/* Create SubNav Items */
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-profile', 'title' => __('My Profile', 'dbem'), 'href' => $em_link . 'profile/');
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-attending', 'title' => __('Events I\'m Attending', 'dbem'), 'href' => $em_link . 'attending/');
if ($can_manage_events) {
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-my-events', 'title' => __('My Events', 'dbem'), 'href' => $em_link . 'my-events/');
}
if ($can_manage_locations && get_option('dbem_locations_enabled')) {
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-my-locations', 'title' => __('My Locations', 'dbem'), 'href' => $em_link . 'my-locations/');
}
if ($can_manage_bookings && get_option('dbem_rsvp_enabled')) {
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-my-bookings', 'title' => __('My Event Bookings', 'dbem'), 'href' => $em_link . 'my-bookings/');
}
if (bp_is_active('groups')) {
/* Create Profile Group Sub-Nav */
$wp_admin_nav[] = array('parent' => 'my-account-groups', 'id' => 'my-account-groups-' . $this->id, 'title' => __('Events', 'dbem'), 'href' => trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()) . 'group-events/');
}
}
parent::setup_admin_bar($wp_admin_nav);
}
开发者ID:batruji,项目名称:metareading,代码行数:43,代码来源:bp-em-core.php
示例16: setup_admin_bar
/**
* Builds the user's navigation in WP Admin Bar
*
* @package WP Idea Stream
* @subpackage buddypress/loader
*
* @since 2.0.0
*
* @uses is_user_logged_in() to check if the user is logged in
* @uses bp_loggedin_user_domain() to get current user's profile link
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user
if (!is_user_logged_in()) {
return;
}
// Build logged in user's ideas BuddyPress profile link
$idea_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
// Build logged in user main nav
$wp_admin_nav[] = array('parent' => 'my-account-buddypress', 'id' => 'my-account-' . $this->slug, 'title' => $this->name, 'href' => $idea_link);
foreach ($this->idea_nav as $key => $nav) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->slug, 'id' => 'my-account-' . $this->slug . '-' . $key, 'title' => $nav['name'], 'href' => trailingslashit($idea_link . $nav['slug']));
}
parent::setup_admin_bar($wp_admin_nav);
}
开发者ID:BoweFrankema,项目名称:wp-idea-stream,代码行数:26,代码来源:loader.php
示例17: setup_cache_groups
/**
* Setup cache groups
*
* @since 2.2.0
*/
public function setup_cache_groups()
{
// Global groups.
wp_cache_add_global_groups(array('bp_groups', 'bp_group_admins', 'bp_group_invite_count', 'group_meta'));
parent::setup_cache_groups();
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:11,代码来源:bp-groups-loader.php
示例18: setup_cache_groups
/**
* Setup cache groups
*
* @since BuddyPress (2.2.0)
*/
public function setup_cache_groups()
{
// Global groups
wp_cache_add_global_groups(array('bp_xprofile', 'bp_xprofile_data', 'bp_xprofile_groups', 'xprofile_meta'));
parent::setup_cache_groups();
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:11,代码来源:bp-xprofile-loader.php
示例19:
/**
* Sets up the title for pages and <title>
*
* @global obj $bp
*/
function setup_title()
{
global $bp;
if (bp_is_messages_component()) {
if (bp_is_my_profile()) {
$bp->bp_options_title = __('My Messages', 'buddypress');
} else {
$bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'type' => 'thumb'));
$bp->bp_options_title = $bp->displayed_user->fullname;
}
}
parent::setup_title();
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:18,代码来源:bp-messages-loader.php
示例20: sprintf
/**
* Sets up the title for pages and <title>
*
* @global BuddyPress $bp The one true BuddyPress instance
*/
function setup_title()
{
global $bp;
// Adjust title
if (bp_is_friends_component()) {
if (bp_is_my_profile()) {
$bp->bp_options_title = __('Friendships', 'buddypress');
} else {
$bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
$bp->bp_options_title = bp_get_displayed_user_fullname();
}
}
parent::setup_title();
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:19,代码来源:bp-friends-loader.php
注:本文中的BP_Component类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论