+case 'register' :
+ if ( FALSE == get_option('users_can_register') ) {
+ wp_redirect('wp-login.php?registration=disabled');
+ exit();
+ }
+
+ if ( $_POST ) {
+ require_once( ABSPATH . WPINC . '/registration.php');
+
+ $user_login = sanitize_user( $_POST['user_login'] );
+ $user_email = apply_filters( 'user_registration_email', $_POST['user_email'] );
+
+ // Check the username
+ if ( $user_login == '' )
+ $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
+ elseif ( !validate_username( $user_login ) ) {
+ $errors['user_login'] = __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.');
+ $user_login = '';
+ } elseif ( username_exists( $user_login ) )
+ $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.');
+
+ // Check the e-mail address
+ if ($user_email == '') {
+ $errors['user_email'] = __('<strong>ERROR</strong>: Please type your e-mail address.');
+ } elseif ( !is_email( $user_email ) ) {
+ $errors['user_email'] = __('<strong>ERROR</strong>: The email address isn’t correct.');
+ $user_email = '';
+ } elseif ( email_exists( $user_email ) )
+ $errors['user_email'] = __('<strong>ERROR</strong>: This email is already registered, please choose another one.');
+
+ do_action('register_post');
+
+ $errors = apply_filters( 'registration_errors', $errors );
+
+ if ( empty( $errors ) ) {
+ $user_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
+
+ $user_id = wp_create_user( $user_login, $user_pass, $user_email );
+ if ( !$user_id )
+ $errors['registerfail'] = sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email'));
+ else {
+ wp_new_user_notification($user_id, $user_pass);
+
+ wp_redirect('wp-login.php?checkemail=registered');
+ exit();
+ }
+ }
+ }
+
+ login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>');
+?>
+
+<form name="registerform" id="registerform" action="wp-login.php?action=register" method="post">
+ <p>
+ <label><?php _e('Username:') ?><br />
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
+ </p>
+ <p>
+ <label><?php _e('E-mail:') ?><br />
+ <input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
+ </p>
+<?php do_action('register_form'); ?>
+ <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
+ <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register »'); ?>" tabindex="100" /></p>
+</form>
+</div>
+
+<ul>
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li>
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
+ <li><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('Back to %s'), get_bloginfo('title', 'display')); ?></a></li>
+</ul>
+
+</body>
+</html>
+<?php
+break;