本文整理汇总了PHP中BP_Component类的典型用法代码示例。如果您正苦于以下问题:PHP BP_Component类的具体用法?PHP BP_Component怎么用?PHP BP_Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BP_Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
}
示例4: 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();
}
示例5: 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);
}
示例6:
/**
* 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();
}
}
示例7: 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);
}
示例8: 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();
}
示例9: 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();
}
示例10: 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);
}
}
示例11: 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'));
}
示例12: 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();
}
示例13: 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;
}
示例14: 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);
}
示例15: 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);
}