"Enter" drücken, um zum Inhalt weiterzugehen

Subblog Registrations on WordPress 3.3.1

On WordPress Multisite it is not possible per default for users to register for sub-blogs. You are automatically redirected to the main blog.

This is how you can solve the problem in wp-login.php:

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‘ :
// Multisite uses wp-signup.php
//wp_redirect( apply_filters( ‚wp_signup_location‘, site_url(‚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( $sanitized_user_login ) && email_exists( $user_email ) )
{

$userid = username_exists($sanitized_user_login);
$blogid = $GLOBALS[‚current_site‘]->site_id;
add_user_to_blog($blogid, $userid, „subscriber“);
}
else
{

The closing bracket is placed before 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
this somewhere on the screen too.
In the Main part in case ‚register‘ following the line
the message can be changed to: A password will be e-mailed to you, if you register for the
first time.

4. Users are registered with default role as subscriber. Roles can be easily changed in the
Blog Settings.