Пример #1
0
/**
 * Fired for each blog when the plugin is activated.
 *
 * @since	1.0
 *
 * @param    boolean $network_wide    True if WPMU superadmin uses
 *                                    "Network Activate" action, false if
 *                                    WPMU is disabled or plugin is
 *                                    activated on an individual blog.
 */
function bsearch_install($network_wide)
{
    global $wpdb;
    if (is_multisite() && $network_wide) {
        // Get all blogs in the network and activate plugin on each one.
        $blog_ids = $wpdb->get_col("\n        \tSELECT blog_id FROM {$wpdb->blogs}\n\t\t\tWHERE archived = '0' AND spam = '0' AND deleted = '0'\n\t\t");
        foreach ($blog_ids as $blog_id) {
            switch_to_blog($blog_id);
            bsearch_single_activate();
        }
        // Switch back to the current blog.
        restore_current_blog();
    } else {
        bsearch_single_activate();
    }
}
Пример #2
0
/**
 * Fired when a new site is activated with a WPMU environment.
 *
 * @since	2.0.0
 *
 * @param    int $blog_id    ID of the new blog.
 */
function bsearch_activate_new_site($blog_id)
{
    if (1 !== did_action('wpmu_new_blog')) {
        return;
    }
    switch_to_blog($blog_id);
    bsearch_single_activate();
    restore_current_blog();
}