bbPress and Multisite Sanity Saver/Savior

By default bbPress will enroll you as a form participant on every site you go to when you’re logged in on a multisite installation. It is meant to be helpful but usually results in a headache. People get nervous that people they don’t know are in their users list. Other people want to un-enroll to clean up their sites list. I found this solution a while back but since the way I did required modifying a core file it was overwritten on a recent update. It took me a while to figure out what what was done where so I’m putting it in this post as a reminder and with slightly more specific directions for other similarly clueless people.

You’ll be editing the following file bbpress/inlcudes/users/capabilities.php that ought to live in your plugins directory (wp-content/plugins/bbpress)

All you need to do is look for the /** Ready comment and then replace the code below

	/** Ready *****************************************************************/

	// Load up bbPress once
	$bbp         = bbpress();

	// Get whether or not to add a role to the user account
	$add_to_site = bbp_allow_global_access();

with (I duplicated some code that isn’t actually replaced to help show more context)

/** Ready *****************************************************************/

	// Load up bbPress once
	$bbp         = bbpress();

	// Get whether or not to add a role to the user account
	$blog_role = bbp_get_user_blog_role( $user_id );
	$add_to_site = bbp_allow_global_access() && $blog_role != false;

Comments on this post

  1. Tom Woodward said on January 28, 2016 at 3:57 pm

    New line needs to be $add_to_site = bbp_allow_global_access() && $user_role != false;

Leave a Reply

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL