[wp-trac] [WordPress Trac] #14170: Problems with network activation
WordPress Trac
wp-trac at lists.automattic.com
Thu Oct 7 00:17:02 UTC 2010
#14170: Problems with network activation
--------------------------+-------------------------------------------------
Reporter: scribu | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 3.1
Component: Multisite | Version:
Severity: major | Keywords: needs-patch
--------------------------+-------------------------------------------------
Comment(by coolmann):
Hi everybody, I know this is not a support forum, but please allow me to
ask a question about this specific issue. I'm developing a plugin and I'd
like to make it multi-site aware. Since things are changing in WP 3.1
about the network activation, per your discussion here above, I wanted to
understand if it's safe to use the following code for my activation
function
{{{
register_activation_hook( __FILE__, 'coolmann_activate' );
function coolmann_activate() {
global $wpdb;
if (function_exists('is_multisite') && is_multisite()) {
if (isset($_GET['networkwide']) && ($_GET['networkwide']
== 1)) {
$old_blog = $wpdb->blogid;
// Get all blog ids
$blogids = $wpdb->get_col($wpdb->prepare("SELECT
blog_id FROM $wpdb->blogs"));
foreach ($blogids as $blog_id) {
switch_to_blog($blog_id);
_single_blog_activate();
}
switch_to_blog($old_blog);
return;
}
}
_single_blog_activate();
}
}}}
where _single_blog_activate() is the function that I use to initialize
options, tables, etc. What do you think?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14170#comment:22>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list