Per Blog Registrations on WPMU 2.7.1

Problem:
Registration possible only for the Main Blog with Setting „User Accounts Registration only“.
Required: Users can register for multiple Sub Blogs.

Use Case: A Faculty member set up different blogs. Students were assigned to write posts
on these blogs. They registered and had subscriber status for the Main Blog. Now they
were manually added to the desired blog. With approximately 100 students there is a lot to
do. So it would be nice to have students automatically sign up for a specific blog.

First solution:
WPMU Per-Blog Registrations Plugin by Nathan Kinkade:
http://code.creativecommons.org/viewsvn/wordpressmu/trunk/mu-
plugins/per_blog_registrations/perBlogRegistrations.php?view=log
This did not work for us. Users still got redirected to the Main Blog with wp-signup.php.

Second solution:
Prerequisite:
Sub Blog Setting is „Users can Register“: 1

Changes in wp-login.php:
1) In the Main part in case ‚register‘ two lines should be commented out: wp_direct and
exit. These are the lines responsible for redirecting to wp-sign-up with the Main Blog.
If the redirect does not take place, users can register with the Sub Blog.
case ‚register‘ :
// WPMU doesn’t use this
//wp_redirect( get_bloginfo(‚wpurl‘) . ‚/wp-signup.php‘ );
//exit;
With these changes users can register only once for one Sub Blog. For another Sub Blog
they would have to log in with a new account. To allow students to register with multiple
Sub Blogs further changes have to be made in wp-login.php.

2) For multiple Sub Blog Registration the function „register_new_user“ is supplemented
by the following request: If a user is already registered username and email both have to
be existent. If they both exist, the user is added as a subscriber to the blog:
Following the line: $user_email = apply_filters( ‚user_registration_email‘, $user_email );
these lines are added:

if( username_exists( $user_login ) && email_exists( $user_email ) )
{
$userid = username_exists( $user_login );
add_user_to_blog( $current_site->blog_id, $userid, „subscriber“);
}
else
{
The closing bracket is placed after return $user_id;

3. What does the user get? The user goes to register for the Sub Blog and fills in his or her
username and email adress. With first time registering a password is sent to the person’s
email adress. If already registered, there is no password sent. So it would be nice to read

11 Replies to “Per Blog Registrations on WPMU 2.7.1”

  1. Hello,

    I tested ypur method (Second solution with the two steps) on WPMU 2.8.4 and it Works perfectly.
    Thank you for tthis sharing. May be you should publish this solution on WPMU forum there is some topics dealing with this problem.

    Sincerely,

    Wahbi

  2. I think this was so far the best find on this particular topic. I have been trying to figure this out for a few days now. I do have additional question if you are able help me out with it…

    I have been trying to integrate register-plus plugin with THIS particular form of registration.

    I am keeping the create blog on MU as MU has it,,, I am allowing people to register as authors to specific blogs,,, but I would like to protect that registration form from sploggers and register plus is just optimal for it… (I can’t get it to work on MU however)

    Would you have any thoughts about this?

    Thanks so much for the tip on this one…

    Kris

  3. This has sorted us out (WP-MU 2.8.4a). I thought the SR didn’t seem right – users ended up only registered with the root blog. These quick mods to wp-login.php have fixed the problem. Thanks!

  4. I did Step #1 and now users can register for a particular blog but it brings them in as a subscriber. I currently have MU set to default to contributor.

    Any help would be greatly appreciated.

  5. What about sub-blogs are coming from new wordpress 3.0 installation not from wpmu installation? I need a n for Per Blog Registrations on WP 3.0.
    Can someone help – thanks

Comments are closed.