本文整理汇总了PHP中bp_is_active函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_active函数的具体用法?PHP bp_is_active怎么用?PHP bp_is_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_active函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: includes
/**
* Include the needed file
*
* @since 1.0.0
*/
private function includes()
{
if (!bp_is_active('groups')) {
return;
}
require $this->includes_dir . 'alt-public-group-ctrl.php';
}
开发者ID:nightbook,项目名称:altctrl-public-group,代码行数:12,代码来源:altctrl-public-group.php
示例2: bp_blogs_register_widgets
function bp_blogs_register_widgets()
{
global $nxtdb, $bp;
if (bp_is_active('activity') && (int) $nxtdb->blogid == bp_get_root_blog_id()) {
add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");'));
}
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:7,代码来源:bp-blogs-widgets.php
示例3: setup_settings
public function setup_settings()
{
// General
add_settings_section('bp-docs-general', __('General', 'bp-docs'), array($this, 'general_section'), 'bp-docs-settings');
// General - Docs slug
add_settings_field('bp-docs-slug', __('Slug', 'bp-docs'), array($this, 'slug_setting_markup'), 'bp-docs-settings', 'bp-docs-general');
register_setting('bp-docs-settings', 'bp-docs-slug', 'rawurlencode');
// General - Excerpt length
add_settings_field('bp-docs-excerpt-length', __('Directory Excerpt Length', 'bp-docs'), array($this, 'excerpt_length_setting_markup'), 'bp-docs-settings', 'bp-docs-general');
register_setting('bp-docs-settings', 'bp-docs-excerpt-length', 'absint');
// Users
add_settings_section('bp-docs-users', __('Users', 'bp-docs'), array($this, 'users_section'), 'bp-docs-settings');
// Users - Tab name
add_settings_field('bp-docs-user-tab-name', __('User Tab Name', 'bp-docs'), array($this, 'user_tab_name_setting_markup'), 'bp-docs-settings', 'bp-docs-users');
register_setting('bp-docs-settings', 'bp-docs-user-tab-name');
// Groups
if (bp_is_active('groups')) {
add_settings_section('bp-docs-groups', __('Groups', 'bp-docs'), array($this, 'groups_section'), 'bp-docs-settings');
// Groups - Tab name
add_settings_field('bp-docs-tab-name', __('Group Tab Name', 'bp-docs'), array($this, 'group_tab_name_setting_markup'), 'bp-docs-settings', 'bp-docs-groups');
register_setting('bp-docs-settings', 'bp-docs-tab-name');
}
// Attachments
add_settings_section('bp-docs-attachments', __('Attachments', 'bp-docs'), array($this, 'attachments_section'), 'bp-docs-settings');
// Users - Tab name
add_settings_field('bp-docs-enable-attachments', __('Enable Attachments', 'bp-docs'), array($this, 'enable_attachments_setting_markup'), 'bp-docs-settings', 'bp-docs-attachments');
register_setting('bp-docs-settings', 'bp-docs-enable-attachments');
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:28,代码来源:admin.php
示例4: includes
/**
* Includes.
*/
public function includes($includes = array())
{
/** Backwards-compatibility ******************************************/
// template stack for BP < 1.7
if (!class_exists('BP_Theme_Compat')) {
require $this->path . '/backpat/template-stack.php';
}
// activity scope for BP < 2.2
if (!class_exists('BP_Activity_Query')) {
require $this->path . '/backpat/activity-scope.php';
}
/** Core **************************************************************/
require $this->path . '/bp-follow-classes.php';
require $this->path . '/bp-follow-functions.php';
// users module
if (true === (bool) apply_filters('bp_follow_enable_users', true)) {
require $this->path . '/users/screens.php';
require $this->path . '/users/actions.php';
require $this->path . '/users/hooks.php';
require $this->path . '/users/template.php';
require $this->path . '/users/notifications.php';
require $this->path . '/users/widgets.php';
}
// blogs module - on multisite and BP 2.0+ only
if (function_exists('bp_add_option') && bp_is_active('blogs') && is_multisite() && bp_is_network_activated() && apply_filters('bp_follow_enable_blogs', true)) {
require $this->path . '/modules/blogs.php';
}
// updater
if (defined('WP_NETWORK_ADMIN')) {
require $this->path . '/bp-follow-updater.php';
}
}
开发者ID:vikramshaw,项目名称:buddypress-followers,代码行数:35,代码来源:bp-follow-core.php
示例5: set_up_levels
protected function set_up_levels()
{
// Everyone can see 'anyone' docs
$this->levels[] = bp_docs_get_access_term_anyone();
// Logged-in users
// Note that we're not verifying that the user actually exists
// For now this kind of check is up to whoever's instantiating
if ($this->user_id != 0) {
$this->levels[] = bp_docs_get_access_term_loggedin();
if (bp_is_active('groups')) {
$this->set_up_user_groups();
if (isset($this->user_groups['groups'])) {
foreach ($this->user_groups['groups'] as $member_group) {
$this->levels[] = bp_docs_get_access_term_group_member($member_group);
}
}
// admins-mods
if (isset($this->user_groups['admin_mod_of'])) {
foreach ($this->user_groups['admin_mod_of'] as $adminmod_group) {
$this->levels[] = bp_docs_get_access_term_group_adminmod($adminmod_group);
}
}
}
// no-one
// creator
// @todo What's the difference?
$this->levels[] = bp_docs_get_access_term_user($this->user_id);
}
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:29,代码来源:access-query.php
示例6: bp_members_admin_bar_user_admin_menu
/**
* Adds the User Admin top-level menu to user pages
*
* @package BuddyPress
* @since BuddyPress (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;
}
// 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()));
// 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
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-change-avatar', 'title' => __("Edit Avatar", '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/'));
}
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:32,代码来源:bp-members-adminbar.php
示例7: __construct
function __construct()
{
// The plugin won't run without groups
// For now, reviews are pegged to activity. Todo: move to cpts
if (!bp_is_active('groups') || !bp_is_active('activity')) {
return false;
}
$this->includes();
add_action('bp_init', array($this, 'maybe_update'));
add_action('bp_setup_globals', array($this, 'setup_globals'));
add_action('groups_setup_nav', array($this, 'current_group_set_available'));
add_action('groups_setup_nav', array($this, 'setup_current_group_globals'));
add_action('wp_print_scripts', array($this, 'load_js'));
add_action('wp_head', array($this, 'maybe_previous_data'), 999);
add_action('wp_print_styles', array($this, 'load_styles'));
add_action('bp_actions', array($this, 'grab_cookie'), 1);
add_filter('bp_has_activities', array($this, 'activities_template_data'));
add_filter('bp_has_groups', array($this, 'groups_template_data'));
// For BP 1.5+
add_action('bp_activity_before_action_delete_activity', array($this, 'delete_activity'), 10, 2);
// For BP < 1.5
add_action('bp_activity_action_delete_activity', array($this, 'delete_activity'), 10, 2);
add_action('bp_activity_excerpt_length', array($this, 'activity_excerpt_length'));
add_action('bp_get_activity_content_body', array($this, 'strip_star_tags'));
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:25,代码来源:bp-group-reviews.php
示例8: bpsp_check
/**
* bpsp_check()
* Will check for Courseware dependencies and active components
*
* @return True on errors
* @uses `admin_notices`
*/
function bpsp_check()
{
$messages = array();
if (apply_filters('bpsp_require_buddypress', true)) {
if (function_exists('bp_get_version')) {
// @todo make sure that bbpress is enabled? or ignore?
//foreach( array( 'groups', 'activity', 'xprofile', 'forums', 'messages' ) as $c )
foreach (array('groups', 'activity', 'xprofile', 'messages') as $c) {
if (!bp_is_active($c)) {
$messages[] = sprintf(__('BuddyPress Courseware dependency error: <a href="%1$s">%2$s has to be activated</a>!', 'bpsp'), admin_url('admin.php?page=bp-general-settings'), $c);
}
}
} else {
$messages[] = sprintf(__('BuddyPress Courseware dependency error: Please <a href="%1$s">install BuddyPress</a>!', 'bpsp'), admin_url('plugins.php'));
}
}
if (!empty($messages)) {
echo '<div id="message" class="error fade">';
foreach ($messages as $m) {
echo "<p>{$m}</p>";
}
echo '</div>';
return false;
}
return true;
}
开发者ID:warinermedia,项目名称:buddypress-courseware,代码行数:33,代码来源:bp-courseware.php
示例9: bp_blogs_register_widgets
/**
* Register the widgets for the Blogs component.
*/
function bp_blogs_register_widgets()
{
global $wpdb;
if (bp_is_active('activity') && bp_is_root_blog($wpdb->blogid)) {
add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");'));
}
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:10,代码来源:bp-blogs-widgets.php
示例10: friends_notification_accepted_request
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
$friend_name = bp_core_get_user_displayname($friend_id);
if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
return false;
}
$ud = get_userdata($initiator_id);
$friend_link = bp_core_get_user_domain($friend_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = trailingslashit(bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications');
// Set up and send the message
$to = $ud->user_email;
$subject = bp_get_email_subject(array('text' => sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name)));
$message = sprintf(__('%1$s accepted your friend request.
To view %2$s\'s profile: %3$s
---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
// Only show the disable notifications line if the settings component is enabled
if (bp_is_active('settings')) {
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
}
/* Send the message */
$to = apply_filters('friends_notification_accepted_request_to', $to);
$subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name);
$message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link);
wp_mail($to, $subject, $message);
do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:30,代码来源:bp-friends-notifications.php
示例11: activitysub_load_buddypress
/**
* Legacy loader for BP < 1.2
*
* This function will be unhooked by ass_loader() when possible
*/
function activitysub_load_buddypress()
{
global $ass_activities;
if (function_exists('bp_core_setup_globals')) {
// Don't load the plugin if activity and groups are not both active
if (function_exists('bp_is_active') && (!bp_is_active('groups') || !bp_is_active('activity'))) {
return false;
}
require_once 'bp-activity-subscription-main.php';
return true;
}
/* Get the list of active sitewide plugins */
$active_sitewide_plugins = maybe_unserialize(get_site_option('active_sitewide_plugins'));
if (!isset($active_sidewide_plugins['buddypress/bp-loader.php'])) {
return false;
}
if (isset($active_sidewide_plugins['buddypress/bp-loader.php']) && !function_exists('bp_core_setup_globals')) {
require_once WP_PLUGIN_DIR . '/buddypress/bp-loader.php';
// Don't load the plugin if activity and groups are not both active
if (function_exists('bp_is_active') && (!bp_is_active('groups') || !bp_is_active('activity'))) {
return false;
}
require_once 'bp-activity-subscription-main.php';
return true;
}
return false;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:32,代码来源:bp-activity-subscription.php
示例12: validate
/**
* Validate and sanitise the parameters for the suggestion service query.
*
* @since 2.1.0
*
* @return true|WP_Error If validation fails, return a WP_Error object. On success, return true (bool).
*/
public function validate()
{
$this->args['group_id'] = (int) $this->args['group_id'];
/**
* Filters the arguments used to validate and sanitize suggestion service query.
*
* @since 2.1.0
*
* @param array $args Array of arguments for the suggestion service query.
* @param BP_Groups_Member_Suggestions $this Instance of the current suggestion class.
*/
$this->args = apply_filters('bp_groups_member_suggestions_args', $this->args, $this);
// Check for invalid or missing mandatory parameters.
if (!$this->args['group_id'] || !bp_is_active('groups')) {
return new WP_Error('missing_requirement');
}
// Check that the specified group_id exists, and that the current user can access it.
$the_group = groups_get_group(array('group_id' => absint($this->args['group_id']), 'populate_extras' => true));
if ($the_group->id === 0 || !$the_group->user_has_access) {
return new WP_Error('access_denied');
}
/**
* Filters the validation results for the suggestion service query.
*
* @since 2.1.0
*
* @param bool|WP_Error $value True if valid, WP_Error if not.
* @param BP_Groups_Member_Suggestions $this Instance of the current suggestion class.
*/
return apply_filters('bp_groups_member_suggestions_validate_args', parent::validate(), $this);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:38,代码来源:class-bp-groups-member-suggestions.php
示例13: bp_tpack_theme_setup
/**
* Sets up NXTClass theme for BuddyPress support.
*
* @since 1.2
*/
function bp_tpack_theme_setup()
{
global $bp;
// Load the default BuddyPress AJAX functions if it isn't explicitly disabled
if (!(int) get_option('bp_tpack_disable_js')) {
require_once BP_PLUGIN_DIR . '/bp-themes/bp-default/_inc/ajax.php';
}
if (!is_admin()) {
// Register buttons for the relevant component templates
// Friends button
if (bp_is_active('friends')) {
add_action('bp_member_header_actions', 'bp_add_friend_button');
}
// Activity button
if (bp_is_active('activity')) {
add_action('bp_member_header_actions', 'bp_send_public_message_button');
}
// Messages button
if (bp_is_active('messages')) {
add_action('bp_member_header_actions', 'bp_send_private_message_button');
}
// Group buttons
if (bp_is_active('groups')) {
add_action('bp_group_header_actions', 'bp_group_join_button');
add_action('bp_group_header_actions', 'bp_group_new_topic_button');
add_action('bp_directory_groups_actions', 'bp_group_join_button');
}
// Blog button
if (bp_is_active('blogs')) {
add_action('bp_directory_blogs_actions', 'bp_blogs_visit_blog_button');
}
}
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:38,代码来源:bpt-functions.php
示例14: validate
/**
* Validate and sanitise the parameters for the suggestion service query.
*
* @since 2.1.0
*
* @return true|WP_Error If validation fails, return a WP_Error object. On success, return true (bool).
*/
public function validate()
{
$this->args['only_friends'] = (bool) $this->args['only_friends'];
/**
* Filters the members suggestions args for the current user.
*
* @since 2.1.0
*
* @param array $args Array of arguments for the member suggestions.
* @param BP_Members_Suggestions $this Current BP_Members_Suggestions instance.
*/
$this->args = apply_filters('bp_members_suggestions_args', $this->args, $this);
// Check for invalid or missing mandatory parameters.
if ($this->args['only_friends'] && (!bp_is_active('friends') || !is_user_logged_in())) {
return new WP_Error('missing_requirement');
}
/**
* Filters the validation status for the suggestion service query.
*
* @since 2.1.0
*
* @param bool|WP_Error $value Results of validation check.
* @param BP_Members_Suggestions $this Current BP_Members_Suggestions instance.
*/
return apply_filters('bp_members_suggestions_validate_args', parent::validate(), $this);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:33,代码来源:class-bp-members-suggestions.php
示例15: cp_load_bp_functions
/**
* Loads CP's BuddyPress functionality
*
* A few things are required for BuddyPress functionality to work:
* - Must be running at least BP 1.5
* - Must have the Groups component enabled
*/
function cp_load_bp_functions()
{
$error_message = '';
if (!bp_is_active('groups')) {
$error_type = 'no_bp_groups';
$error_message = __('CollabPress BuddyPress integration requires the BP Groups component to be activated. Not using BP Groups? No problem - you’ll still be able to use CollabPress on the Dashboard.', 'collabpress');
} else {
if (version_compare(BP_VERSION, '1.5', '<')) {
$error_type = 'no_bp_15';
$error_message = __('CollabPress BuddyPress integration requires v1.5+ of BuddyPress to work. Download a copy from <a href="http://buddypress.org">buddypress.org</a>. Not ready to upgrade to BuddyPress 1.5? No problem. You can continue to use CollabPress - you just won’t get any BuddyPress integration yet.', 'collabpress');
}
}
// If an error message has been set, see whether we should throw an
// an error, then bail
if ($error_message && $error_type) {
if (current_user_can('activate_plugins')) {
$dismissed = (array) get_option('cp_dismissed_messages');
if (!isset($dismissed[$error_type])) {
// Groan
$dismiss_url = add_query_arg('cp_dismiss', $error_type, $_SERVER['REQUEST_URI']);
$dismiss_url = wp_nonce_url($dismiss_url, 'cp_dismiss_notice');
$error_message .= ' <span class="description"><a href="' . $dismiss_url . '">' . __('Dismiss this message.', 'collabpress') . '</a></span>';
add_action('admin_notices', create_function('', 'echo \'<div class="updated fade"><p>' . $error_message . '</p></div>\';'));
}
}
return;
}
// Still here? Load BP functionality
require_once COLLABPRESS_PLUGIN_DIR . 'includes/cp-bp.php';
}
开发者ID:Parkproductions,项目名称:CollabPress,代码行数:37,代码来源:cp-core.php
示例16: mpp_current_component_type_for_groups
/**
* set current component_type to groups if we are on groups page
* @see mpp_get_current_component()
* @param type $component
* @return type
*/
function mpp_current_component_type_for_groups($component)
{
if (bp_is_active('groups') && bp_is_group()) {
return buddypress()->groups->id;
}
return $component;
}
开发者ID:enboig,项目名称:mediapress,代码行数:13,代码来源:mpp-bp-groups-hooks.php
示例17: bp_dtheme_setup
/**
* Sets up theme defaults and registers support for various WordPress and BuddyPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override bp_dtheme_setup() in a child theme, add your own bp_dtheme_setup to your child theme's
* functions.php file.
*
* @global object $bp Global BuddyPress settings object
* @since 1.5
*/
function bp_dtheme_setup()
{
global $bp;
// Load the AJAX functions for the theme
require TEMPLATEPATH . '/_inc/ajax.php';
if (!is_admin()) {
// Register buttons for the relevant component templates
// Friends button
if (bp_is_active('friends')) {
add_action('bp_member_header_actions', 'bp_add_friend_button');
}
// Activity button
if (bp_is_active('activity')) {
add_action('bp_member_header_actions', 'bp_send_public_message_button');
}
// Messages button
if (bp_is_active('messages')) {
add_action('bp_member_header_actions', 'bp_send_private_message_button');
}
// Group buttons
if (bp_is_active('groups')) {
add_action('bp_group_header_actions', 'bp_group_join_button');
add_action('bp_group_header_actions', 'bp_group_new_topic_button');
add_action('bp_directory_groups_actions', 'bp_group_join_button');
}
// Blog button
if (bp_is_active('blogs')) {
add_action('bp_directory_blogs_actions', 'bp_blogs_visit_blog_button');
}
}
}
开发者ID:hscale,项目名称:webento,代码行数:44,代码来源:bp-functions.php
示例18: load
/**
* Load
* @since 0.1
* @version 1.3.1
*/
public function load()
{
// Admin Styling
add_action('admin_head', array($this, 'admin_header'));
add_action('admin_notices', array($this, 'admin_notices'));
// Custom Columns
add_filter('manage_users_columns', array($this, 'custom_user_column'));
add_action('manage_users_custom_column', array($this, 'custom_user_column_content'), 10, 3);
// User Edit
global $bp;
// Check if BuddyPress is being used
if (is_object($bp) && isset($bp->version) && bp_is_active('xprofile')) {
$this->using_bp = true;
}
// Edit Profile
if (!$this->using_bp) {
add_action('edit_user_profile', array($this, 'user_nav'));
}
add_action('personal_options', array($this, 'show_my_balance'));
add_filter('mycred_admin_pages', array($this, 'edit_profile_menu'), 10, 2);
add_action('mycred_init', array($this, 'edit_profile_actions'));
// Sortable Column
add_filter('manage_users_sortable_columns', array($this, 'sortable_points_column'));
add_action('pre_user_query', array($this, 'sort_by_points'));
// Inline Editing
add_action('wp_ajax_mycred-inline-edit-users-balance', array($this, 'inline_edit_user_balance'));
add_action('in_admin_footer', array($this, 'admin_footer'));
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:33,代码来源:mycred-admin.php
示例19: bp_course_nav_menu
/**
* bp_course_nav_menu()
* Navigation menu for BuddyPress course
*/
function bp_course_nav_menu()
{
$nav = bp_course_get_nav_permalinks();
$defaults = array('' => array('id' => 'home', 'label' => __('Home', 'vibe'), 'action' => '', 'link' => bp_get_course_permalink()), 'curriculum' => array('id' => 'curriculum', 'label' => __('Curriculum', 'vibe'), 'can_view' => 1, 'action' => empty($nav['curriculum_slug']) ? __('curriculum', 'vibe') : $nav['curriculum_slug'], 'link' => bp_get_course_permalink()), 'members' => array('id' => 'members', 'label' => __('Members', 'vibe'), 'can_view' => 1, 'action' => empty($nav['members_slug']) ? __('members', 'vibe') : $nav['members_slug'], 'link' => bp_get_course_permalink()), 'activity' => array('id' => 'activity', 'label' => __('Activity', 'vibe'), 'can_view' => 1, 'action' => empty($nav['activity_slug']) ? __('activity', 'vibe') : $nav['activity_slug'], 'link' => bp_get_course_permalink()));
global $post;
if ($post->post_type == 'course') {
if (function_exists('bp_is_active') && bp_is_active('groups')) {
$vgroup = get_post_meta(get_the_ID(), 'vibe_group', true);
if (!empty($vgroup)) {
$group = groups_get_group(array('group_id' => $vgroup));
$defaults['group'] = array('id' => 'group', 'label' => __('Group', 'vibe'), 'action' => 'group', 'can_view' => 1, 'link' => bp_get_group_permalink($group), 'external' => true);
}
}
if (in_array('bbpress/bbpress.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('bbpress/bbpress.php')) {
$forum = get_post_meta(get_the_ID(), 'vibe_forum', true);
if (!empty($forum)) {
$defaults['forum'] = array('id' => 'forum', 'label' => __('Forum', 'vibe'), 'action' => 'forum', 'can_view' => 1, 'link' => get_permalink($forum), 'external' => true);
}
}
}
$nav_menu = apply_filters('wplms_course_nav_menu', $defaults);
global $bp;
$action = bp_current_action();
if (empty($action)) {
!empty($_GET['action']) ? $action = $_GET['action'] : ($action = '');
}
if (is_array($nav_menu)) {
foreach ($nav_menu as $key => $menu_item) {
$menu_item['action'] = str_replace('/', '', $menu_item['action']);
if ($key == $action) {
$class = 'class="current"';
} else {
$class = '';
}
global $wp_query;
if (!empty($nav[$menu_item['id'] . '_slug'])) {
echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (isset($menu_item['action']) && !isset($menu_item['external']) ? $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
} else {
echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (!empty($menu_item['action']) && !isset($menu_item['external']) ? (strpos($menu_item['link'], '?') ? '&' : '?') . 'action=' . $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
}
}
}
if (is_super_admin() || is_instructor()) {
$admin_slug = empty($nav['admin_slug']) ? _x('admin', 'course admin slug', 'vibe') : $nav['admin_slug'];
$admin_slug = apply_filters('wplms_course_admin_slug', str_replace('/', '', $admin_slug));
?>
<li id="admin" class="<?php
echo !empty($action) && ($action == 'admin' || $action == 'submission' || $action == 'stats') ? 'selected current' : '';
?>
"><a href="<?php
bp_course_permalink();
echo $admin_slug;
?>
"><?php
_e('Admin', 'vibe');
?>
</a></li>
<?php
}
}
开发者ID:nikitansk,项目名称:devschool,代码行数:64,代码来源:bp-course-functions.php
示例20: bp_mutual_friends_init
function bp_mutual_friends_init()
{
// Because our loader file uses BP_Component, it requires BP 1.5 or greater.
if (version_compare(BP_VERSION, '1.3', '>') && bp_is_active('friends')) {
require BP_MUTUAL_FRIENDS_PLUGIN_DIR . '/includes/bp-mutual-friends-loader.php';
}
}
开发者ID:bruce7075,项目名称:Mutual-Buddies,代码行数:7,代码来源:buddypress-mutual-friends.php
注:本文中的bp_is_active函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论