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.
Thanks to a reminder by Andrew on the premium.wpmudev.org forum!
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.
Ok, so here is my stupid question. I installed BuddyPress and it doesn’t update the exisitng users and blogs as you know. I’ll add the bd_ tables to the multi-db config file, but did you have to go into each individual blog and copy the relevant tables to the global database?
I ask cause you say:
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.
How did you copy them? Inquiring and small minds want to know 🙂
the tables were created in the database for one site that I’d been using to test BuddyPress, so I just dumped them from the database, deleted the (empty) ones in the global database, and imported the dump into the global database.
Also, is it your plan to delete the existing bp_ tables and start fresh so that everything populates accordingly on a re-install of BuddyPress?
I don’t think I’ll need to – it seems to be working as expected now…
So my Global database is umwblogs_wpmu_global, so I would just add this to multidb-config
// BuddyPress
add_umwblogs_wpmu_global(‘bp_activity_sitewide’);
add_umwblogs_wpmu_global(‘bp_activity_user_activity’);
add_umwblogs_wpmu_global(‘bp_activity_user_activity_cached’);
add_umwblogs_wpmu_global(‘bp_friends’);
add_umwblogs_wpmu_global(‘bp_groups’);
add_umwblogs_wpmu_global(‘bp_groups_groupmeta’);
add_umwblogs_wpmu_global(‘bp_groups_members’);
add_umwblogs_wpmu_global(‘bp_groups_wire’);
add_umwblogs_wpmu_global(‘bp_messages_messages’);
add_umwblogs_wpmu_global(‘bp_messages_notices’);
add_umwblogs_wpmu_global(‘bp_messages_recipients’);
add_umwblogs_wpmu_global(‘bp_messages_threads’);
add_umwblogs_wpmu_global(‘bp_notifications’);
add_umwblogs_wpmu_global(‘bp_user_blogs’);
add_umwblogs_wpmu_global(‘bp_user_blogs_blogmeta’);
add_umwblogs_wpmu_global(‘bp_user_blogs_comments’);
add_umwblogs_wpmu_global(‘bp_user_blogs_posts’);
add_umwblogs_wpmu_global(‘bp_xprofile_data’);
add_umwblogs_wpmu_global(‘bp_xprofile_fields’);
add_umwblogs_wpmu_global(‘bp_xprofile_groups’);
add_umwblogs_wpmu_global(‘bp_xprofile_wire’);
I don’t know what
add_umwblogs_wpmu_global()
is – is that a custom function?I just edited
wp-content/db-config.php
and slapped the code block (with calls to the stockadd_global_table()
function) from the blog post after the other global table declarations (about line 40 in my file).this assumes that you’ve added a global database server – using the
add_db_server()
function at the bottom ofwp-content/db-config.php
OK, I’m confused, which isn;t hard to do. My global table is titled wpmu_global
add_global_table(‘umwblogs_wpmu_global’);
Are the buddypress tables being added to this database, i.e. wpmu_global?
OK, and beyond that, I installed BuddyPress, but didn’t install the theme or make it specific to anyone on blog, rather just let it run behind through spaces like http://umwblogs.org /members or /blogs or /members/admin
Now, what has me confused is where the hell those databases are amongst my 18 DBs, I can;t seem to locate them, and the fact I use phpMyAdmin makes it more complicated I’m sure.
Sorry to be such a pain in the neck, I know you have a day job beyond helping my sorry ass
yeah. throw the BP tables in
wpmu_global
– if your users haven’t been actively using BP (messages, profiles, groups, etc…) then just let BP recreate the tables as a fresh install.oh. no. wait.
you’d add the BP tables into the same global _database_ – so you’d have
wpmu_global.bp_activity_sitewide
etc…