[wp-hackers] Network activate, but only create one table
Ulrich SOSSOU
sorich87 at gmail.com
Mon Jan 3 13:45:54 UTC 2011
>
> Hi all,
>
> I'm working on the next version of BuddyPress Like, which will be creating
> it's work table. I want it to work with MultiSite, but I only want there to
> be one database table for the whole network rather than a separate one for
> each site. This is so I can more easily bring up stats of the most 'liked'
> content for the whole network.
>
> Currently, I'm using this code to create the database table, pretty normal:
>
> $table_name = $wpdb->prefix . 'likes';
> >
> > if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
> >
> > $sql[] = "CREATE TABLE $table_name (...
>
>
> Which works fine, but when I network activate the plugin it's creating
> wp_likes, wp_2_likes etc.
>
> How would I modify how I'm doing things to still respect any custom table
> prefix that might be set, but only have one table for the whole network?
>
> -- Alex
Use $wpdb->base_prefix.
Ulrich SOSSOU
--------------------------------------------
Q: Why is this email five sentences or less?
A: http://five.sentenc.es
More information about the wp-hackers
mailing list