BuddyPress and MultiDB

I've been trying to get BuddyPress working on my WPMU installation that uses MultiDB for database partitioning. It's been cranky, but I just realized I'm a complete idiot because I was overlooking the obvious (and drop dead simple) fix.

BuddyPress was acting up because it was creating tables in each blog's database tableset. But MultiDB makes it easy to declare tables as belonging to a shared global database, so they don't get recreated for each blog and are common across the entire service.

I edited my db-config.php file to declare the BuddyPress tables as being global, and copied the tables from the database where they had been collecting, into the global database.

// BuddyPress
add_global_table('bp_activity_sitewide');
add_global_table('bp_activity_user_activity');
add_global_table('bp_activity_user_activity_cached');
add_global_table('bp_friends');
add_global_table('bp_groups');
add_global_table('bp_groups_groupmeta');
add_global_table('bp_groups_members');
add_global_table('bp_groups_wire');
add_global_table('bp_messages_messages');
add_global_table('bp_messages_notices');
add_global_table('bp_messages_recipients');
add_global_table('bp_messages_threads');
add_global_table('bp_notifications');
add_global_table('bp_user_blogs');
add_global_table('bp_user_blogs_blogmeta');
add_global_table('bp_user_blogs_comments');
add_global_table('bp_user_blogs_posts');
add_global_table('bp_xprofile_data');
add_global_table('bp_xprofile_fields');
add_global_table('bp_xprofile_groups');
add_global_table('bp_xprofile_wire');


It seems to be working fine. I'll do some more testing, but it's looking promising. If it's really working, I'll be spending some time to BuddyPress-enable the main theme for the WPMU service, and roll it out properly.

See Also

comments powered by Disqus