Can’t Access BuddyPress links Anymore? Try This Power Tip

Quick documenting of a little known edge-case fix. If you head to the BuddyPress forums to find out why users can’t access BuddyPress links anymore, you’re likely to find answers involving a change in how BuddyPress handles themes between version 1.0.3 and version 1.1. The answer typically goes something along the lines of, “Make sure that if you upgrade from BuddyPress 1.0.3 to BuddyPress 1.1, you delete any evidence of the wp-content/bp-themes folder”.

While generally this is the case, there is another gotcha that I discovered today with some help from Andy Peatling. This seems to be a result of a series of actions and “features” in WordPress MU. Let me paint the picture.

1) If you import usernames with spaces in them from a WordPress import into WordPress MU, you will find it impossible to perform some functions in WordPress MU with those “spaced out” users. This is due to an oddity between the two platforms where WordPress allows usernames with spaces in them but WordPress MU does not. The importer in WordPress MU doesn’t respect this fact so it will happily import (or rather create) usernames with spaces. This will need to be ironed out in the merge as there should be consistency between the two platforms.

2) Having imported all content from WordPress into WordPress MU, you need to run some SQL along the lines of

1
UPDATE wp_users SET user_login = REPLACE('wp_users',' ','-');

This of course is not ideal but will do a SQL search and replace of usernames replacing spaces with hyphens effectively sanitizing the username for use in WordPress MU.

3) If you’ve done this with BuddyPress 1.0.3 active, then you should be functional but it creates an orphaned data potential that gets ugly later. Upgrading to BuddyPress 1.1 creates a new problem. Username sanitization is in BP 1.1. It is not in BP 1.0.3. Now there’s an incompatibility, in some cases, with user slugs. Try this solution. Add the following line to your wp-config.php file to enforce compatibility of usernames.

1
define( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE', true );

This is not a perfect solution but it does fix the crazy edge case. Verification should show you that accessing BuddyPress links for users works again. Starting from scratch, though, you should be on WPMU with BuddyPress 1.1.2 at minimum.

Bookmark and Share

About Aaron Brazell
Aaron is the author of the WordPress Bible, an avid WordPress enthusiast and consultant. He also blogs at Technosailor.com on matters of business and technology for journalists, communicators and technologists.

Speak Your Mind