[wp-hackers] MU-compatbility with custom plugin tables?

Derek Hogue derek at amphibian.info
Tue Dec 1 01:19:14 UTC 2009


Thanks for that Austin, that's good to know - though, that's not
exactly what I was looking for.  I do need everyone using their own
tables, as they'll be posting their own list of shows.

So, current behavior in terms of inserting data is fine - it's looking
for the tables that I *want* to be there.  But since GigPress is
installed in 'mu-plugins', blog users never activate the plugin, so
their own set of tables never get installed.

I suppose I could do a quick 'SHOW tables LIKE' check on admin_init to
see if the tables are there, and if not, install them, but that seems
excessive.

Derek

On Nov 30, 6:06 pm, Austin Matzko <if.webs... at gmail.com> wrote:
> On Mon, Nov 30, 2009 at 4:02 PM, Derek Hogue <de... at amphibian.info> wrote:
> > Hey all - recently I've been asked by several users to look into full
> > MU-compatibility for my plugin GigPress. The problem is, GigPress uses
> > 4 custom database tables to hold its data.
>
> > So when it's installed, these tables are created with the current
> > database prefix (say, wp_').  But if the plugin is installed as a site-
> > wide plugin (in the 'mu-plugins' folder), when other users try to add
> > data, it doesn't fly (trying to insert into tables that don't exist,
> > like 'wp_2_gigpress_shows').
>
> > Does MU offer any sort of hook for site-wide-plugins to automatically
> > create these tables for each individual blog when it's created? Or are
> > plugins which use their own DB tables only compatible when put into
> > the 'plugins' folder in MU?
>
> WPMU has $wpdb->base_prefix, which would be "wp_" in your example, and
> the standard WordPress $wpdb->prefix, which changes depending on the
> current blog (changing to things like "wp_2_").  Check for and use
> $wpdb->base_prefix to set up site-wide tables.
> _______________________________________________
> wp-hackers mailing list
> wp-hack... at lists.automattic.comhttp://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list