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


PHP bbp_is_deactivation函数代码示例

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


在下文中一共展示了bbp_is_deactivation函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load_theme_functions

 static function load_theme_functions()
 {
     global $pagenow;
     // If bbPress is being deactivated, do not load any more files
     if (bbp_is_deactivation()) {
         return;
     }
     if (!defined('WP_INSTALLING') || !empty($pagenow) && 'wp-activate.php' !== $pagenow) {
         bbp_locate_template('bbpresskr-functions.php', true);
     }
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:11,代码来源:theme.php

示例2: em_bbp_get_caps_for_role

/**
 * bbPress 2.2 uses dynamic roles, and hooks very early into WP_Roles and the option_wp_user_roles section.
 * This is done to override the default role and apply relevant caps, but then deletes our custom caps as a result.
 * This functions queries the DB directly and re-adds these caps to the bbPress roles depending on settings
 * @param unknown $roles
 */
function em_bbp_get_caps_for_role($caps, $role)
{
    global $em_capabilities_array, $wpdb;
    if (bbp_is_deactivation()) {
        return $caps;
    }
    //get the non-dynamic role from the wp_options table
    $roles = maybe_unserialize($wpdb->get_var("SELECT option_value FROM {$wpdb->options} WHERE option_name='wp_user_roles'"));
    //loop through the original role if it exists and add our em caps to the bp role
    if (!empty($roles[$role])) {
        foreach ($roles[$role]['capabilities'] as $cap_name => $has_cap) {
            if (array_key_exists($cap_name, $em_capabilities_array)) {
                $caps[$cap_name] = $has_cap;
            }
        }
    }
    return $caps;
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:24,代码来源:em-bbpress.php

示例3: setup_actions

 /**
  * Setup the admin hooks, actions and filters
  *
  * @since bbPress (r2646)
  * @access private
  *
  * @uses add_action() To add various actions
  * @uses add_filter() To add various filters
  */
 private function setup_actions()
 {
     // Bail to prevent interfering with the deactivation process
     if (bbp_is_deactivation()) {
         return;
     }
     /** General Actions ***************************************************/
     add_action('bbp_admin_menu', array($this, 'admin_menus'));
     // Add menu item to settings menu
     add_action('bbp_admin_head', array($this, 'admin_head'));
     // Add some general styling to the admin area
     add_action('bbp_admin_notices', array($this, 'activation_notice'));
     // Add notice if not using a bbPress theme
     add_action('bbp_register_admin_style', array($this, 'register_admin_style'));
     // Add green admin style
     add_action('bbp_register_admin_settings', array($this, 'register_admin_settings'));
     // Add settings
     add_action('bbp_activation', array($this, 'new_install'));
     // Add menu item to settings menu
     add_action('admin_enqueue_scripts', array($this, 'enqueue_styles'));
     // Add enqueued CSS
     add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
     // Add enqueued JS
     add_action('wp_dashboard_setup', array($this, 'dashboard_widget_right_now'));
     // Forums 'Right now' Dashboard widget
     add_action('admin_bar_menu', array($this, 'admin_bar_about_link'), 15);
     // Add a link to bbPress about page to the admin bar
     /** Ajax **************************************************************/
     add_action('wp_ajax_bbp_suggest_topic', array($this, 'suggest_topic'));
     add_action('wp_ajax_nopriv_bbp_suggest_topic', array($this, 'suggest_topic'));
     add_action('wp_ajax_bbp_suggest_user', array($this, 'suggest_user'));
     add_action('wp_ajax_nopriv_bbp_suggest_user', array($this, 'suggest_user'));
     /** Filters ***********************************************************/
     // Modify bbPress's admin links
     add_filter('plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2);
     // Map settings capabilities
     add_filter('bbp_map_meta_caps', array($this, 'map_settings_meta_caps'), 10, 4);
     // Hide the theme compat package selection
     add_filter('bbp_admin_get_settings_sections', array($this, 'hide_theme_compat_packages'));
     // Allow keymasters to save forums settings
     add_filter('option_page_capability_bbpress', array($this, 'option_page_capability_bbpress'));
     /** Network Admin *****************************************************/
     // Add menu item to settings menu
     add_action('network_admin_menu', array($this, 'network_admin_menus'));
     /** Dependencies ******************************************************/
     // Allow plugins to modify these actions
     do_action_ref_array('bbp_admin_loaded', array(&$this));
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:57,代码来源:admin.php

示例4: bbp_set_current_user_default_role

/**
 * Add the default role to the current user if needed
 *
 * This function will bail if the forum is not global in a multisite
 * installation of WordPress, or if the user is marked as spam or deleted.
 *
 * @since bbPress (r3380)
 *
 * @uses is_user_logged_in() To bail if user is not logged in
 * @uses bbp_get_user_role() To bail if user already has a role
 * @uses bbp_is_user_inactive() To bail if user is inactive
 * @uses bbp_allow_global_access() To know whether to save role to database
 * @uses bbp_get_user_role_map() To get the WP to BBP role map array
 * @uses bbp_get_default_role() To get the site's default forums role
 * @uses get_option()
 *
 * @return If not multisite, not global, or user is deleted/spammed
 */
function bbp_set_current_user_default_role()
{
    /** Sanity ****************************************************************/
    // Bail if deactivating bbPress
    if (bbp_is_deactivation()) {
        return;
    }
    // Catch all, to prevent premature user initialization
    if (!did_action('set_current_user')) {
        return;
    }
    // Bail if not logged in or already a member of this site
    if (!is_user_logged_in()) {
        return;
    }
    // Get the current user ID
    $user_id = bbp_get_current_user_id();
    // Bail if user already has a forums role
    if (bbp_get_user_role($user_id)) {
        return;
    }
    // Bail if user is marked as spam or is deleted
    if (bbp_is_user_inactive($user_id)) {
        return;
    }
    /** Ready *****************************************************************/
    // Load up bbPress once
    $bbp = bbpress();
    // Get whether or not to add a role to the user account
    $add_to_site = bbp_allow_global_access();
    // Get the current user's WordPress role. Set to empty string if none found.
    $user_role = bbp_get_user_blog_role($user_id);
    // Get the role map
    $role_map = bbp_get_user_role_map();
    /** Forum Role ************************************************************/
    // Use a mapped role
    if (isset($role_map[$user_role])) {
        $new_role = $role_map[$user_role];
        // Use the default role
    } else {
        $new_role = bbp_get_default_role();
    }
    /** Add or Map ************************************************************/
    // Add the user to the site
    if (true === $add_to_site) {
        // Make sure bbPress roles are added
        bbp_add_forums_roles();
        $bbp->current_user->add_role($new_role);
        // Don't add the user, but still give them the correct caps dynamically
    } else {
        $bbp->current_user->caps[$new_role] = true;
        $bbp->current_user->get_role_caps();
    }
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:72,代码来源:capabilities.php

示例5: setup_actions

 /**
  * Setup the default hooks and actions
  *
  * @since bbPress (r2644)
  * @access private
  * @uses add_action() To add various actions
  */
 private function setup_actions()
 {
     // Add actions to plugin activation and deactivation hooks
     add_action('activate_' . $this->basename, 'bbp_activation');
     add_action('deactivate_' . $this->basename, 'bbp_deactivation');
     // If bbPress is being deactivated, do not add any actions
     if (bbp_is_deactivation($this->basename)) {
         return;
     }
     // Array of bbPress core actions
     $actions = array('setup_theme', 'setup_current_user', 'register_post_types', 'register_post_statuses', 'register_taxonomies', 'register_shortcodes', 'register_views', 'register_theme_packages', 'load_textdomain', 'add_rewrite_tags', 'add_rewrite_rules', 'add_permastructs');
     // Add the actions
     foreach ($actions as $class_action) {
         add_action('bbp_' . $class_action, array($this, $class_action), 5);
     }
     // All bbPress actions are setup (includes bbp-core-hooks.php)
     do_action_ref_array('bbp_after_setup_actions', array(&$this));
 }
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:25,代码来源:bbpress.php

示例6: setup_actions

	/**
	 * Setup the default hooks and actions
	 *
	 * @since bbPress (r2644)
	 * @access private
	 * @uses add_action() To add various actions
	 */
	private function setup_actions() {

		// Add actions to plugin activation and deactivation hooks
		add_action( 'activate_'   . $this->basename, 'bbp_activation'   );
		add_action( 'deactivate_' . $this->basename, 'bbp_deactivation' );

		// If bbPress is being deactivated, do not add any actions
		if ( bbp_is_deactivation( $this->basename ) )
			return;

		// Array of bbPress core actions
		$actions = array(
			'setup_theme',              // Setup the default theme compat
			'setup_current_user',       // Setup currently logged in user
			'register_post_types',      // Register post types (forum|topic|reply)
			'register_post_statuses',   // Register post statuses (closed|spam|orphan|hidden)
			'register_taxonomies',      // Register taxonomies (topic-tag)
			'register_shortcodes',      // Register shortcodes (bbp-login)
			'register_views',           // Register the views (no-replies)
			'register_theme_packages',  // Register bundled theme packages (bbp-theme-compat/bbp-themes)
			'load_textdomain',          // Load textdomain (bbpress)
			'add_rewrite_tags',         // Add rewrite tags (view|user|edit|search)
			'add_rewrite_rules',        // Generate rewrite rules (view|edit|paged|search)
			'add_permastructs'          // Add permalink structures (view|user|search)
		);

		// Add the actions
		foreach ( $actions as $class_action )
			add_action( 'bbp_' . $class_action, array( $this, $class_action ), 5 );

		// All bbPress actions are setup (includes bbp-core-hooks.php)
		do_action_ref_array( 'bbp_after_setup_actions', array( &$this ) );
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:40,代码来源:bbpress.php


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