WordPress MU not adding new users as subscribers to main blog

If you’re using WordPress MU you may have run into a problem where new users aren’t added as subscribers to the main blog (blogid: 1). Some may prefer it this way but I ran into this issue on Stampin Corner because I also wanted users to be able to post in the help forums which use BBPress. For some reason nobody could post in there, and it turns out this was the reason.

According to the developers BBPress is a bit behind handling this integration and it’s assumed at some point it will. That said, I got around this irksome problem by creating my own little plugin. (Actually I maintain a custom-functions plugin for just this type of thing). It’s pretty simple really, just create a new file in your mu-plugins directory and this code to it.

add_action('wpmu_activate_blog', 'add_new_user_to_mainblog', 10,2);
add_action('wpmu_new_blog', 'add_new_user_to_mainblog', 10,2);

function add_new_user_to_mainblog($blog_id, $user_id) {
	add_user_to_blog( '1', $user_id, 'subscriber' );

Basically all this is doing is using the hook wpmu_activate_blog to trigger the function add_user_to_blog. WPMU also has this habit (not sure why exactly) of removing an existing user from the main blog when they reated another new blog. Not a huge deal again but problematic if they haven’t logged into BBPress already. So the second add_action triggers on wpmu_new_blog to add the user back.

Simple as that. Of course, this doesn’t handle getting any existing users set as subscribers so you’ll have to do those manually or write a script to do it, but any new users should get added just fine.

WordPress 2.9 released upon the world

WordPress version 2.9 “Carmen” named in honor of magical jazz vocalist Carmen McRae has been released upon the blogging world. You can upgrade easily from your Dashboard by going to Tools > Upgrade, or you can download from WordPress.org.

The coolest new 2.9 features from a user point of view are:

  1. Global undo/”trash” feature, which means that if you accidentally delete a post or comment you can bring it back from the grave (i.e., the Trash). This also eliminates those annoying “are you sure” messages we used to have on every delete.
  2. Built-in image editor allows you to crop, edit, rotate, flip, and scale your images to show them who’s boss. This is the first wave of our many planned media-handling improvements.
  3. Batch plugin update and compatibility checking, which means you can update 10 plugins at once, versus having to do multiple clicks for each one, and we’re using the new compatibility data from the plugins directory to give you a better idea of whether your plugins are compatible with new releases of WordPress. This should take the fear and hassle out of upgrading.
  4. Easier video embeds that allow you to just paste a URL on its own line and have it magically turn it into the proper embed code, with Oembed support for YouTube, Daily Motion, Blip.tv, Flickr, Hulu, Viddler, Qik, Revision3, Scribd, Google Video, Photobucket, PollDaddy, and WordPress.tv (and more in the next release).

There’s also a neat video that usually accompanies major releases. It highlights a few of the changes you can expect to see in this version.

Download WordPress 2.9