Username not the same as blog address
When you create a new blog in WordPress MU (mutli-user), it asks you for blog address, blog title, and admin email. When you submit the form, along with a new blog being created, also a new user is created with matching username (username = blog address). Not everybody likes it that way and with the following 5 minute modification, you can create blogs where the username is not the same as the blog address.
First, add a username field to the form where you create blogs.
(./wp-admin/wpmu-blogs.php)
Right above this line: (in my file it's line 567):
<tr><th scope='row'><?php _e('Blog Title') ?></th><td><input name="blog[title]" type="text" title="<?php _e('Title') ?>" /></td></tr>
insert this line:
<tr><th scope='row'><?php _e('Username') ?></th><td><input name="blog[username]" type="text" title="<?php _e('Username') ?>" /></td></tr>
Then to receive/process the variable after you submit the
form, edit the file that processes the form.
(./wp-admin/wpmu-edit.php)
In the case 'addblog', right below this line:
$blog = $_POST['blog'];
Insert this line:
$username = wp_specialchars($blog['username'] );
Then change the line that says
$user_id = wpmu_create_user($domain, $password, $email );
to this:
$user_id = wpmu_create_user( $username, $password, $email );
That's it!
Paul wrote:
Hey, I don't know if you have had a chance to look at version 1 yet of MU, but when you sign up it asks for a username instead of a blog name. You can then set your blog name once your in the backend
Posted on 03-Nov-06 at 1:45 pm | Permalink
Andrej wrote:
I didn't have a chance to download and try the real 1.0 - I've only been working with RC1 of 1.0. The main point of the functionality I've added is that you can decide what the person's blog name will be as opposed to letting them decide that. It is useful for some settings such as a university hosting blogs / porfolios for students.
Posted on 04-Nov-06 at 3:11 pm | Permalink