当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_is_active函数代码示例

本文整理汇总了PHP中bp_is_active函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_active函数的具体用法?PHP bp_is_active怎么用?PHP bp_is_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_is_active函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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&#8217ll 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&#8217t 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


注:本文中的bp_is_active函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。