/**
  * Returns the proper redirect URL according to action
  *
  * @since 6.0
  * @access public
  *
  * @param string $action The action
  * @return string The redirect URL
  */
 function get_redirect_url($action = '')
 {
     if (empty($action)) {
         $action = $this->action;
     }
     $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
     switch ($action) {
         case 'lostpassword':
         case 'retrievepassword':
             $url = apply_filters('lostpassword_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_current_url('checkemail=confirm'));
             break;
         case 'register':
             $url = apply_filters('registration_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_current_url('checkemail=registered'));
             break;
         case 'login':
         default:
             $url = apply_filters('login_redirect', !empty($redirect_to) ? $redirect_to : admin_url(), $redirect_to, null);
     }
     return apply_filters('tml_redirect_url', $url, $action);
 }
 /**
  * Proccesses the request
  *
  * Callback for "parse_request" hook in WP::parse_request()
  *
  * @see WP::parse_request()
  * @since 6.0
  * @access public
  */
 function parse_request()
 {
     $errors =& $this->errors;
     $action =& $this->request_action;
     $instance =& $this->request_instance;
     if (is_admin()) {
         return;
     }
     do_action_ref_array('tml_request', array(&$this));
     // allow plugins to override the default actions, and to add extra actions if they want
     do_action('login_form_' . $action);
     if (has_action('tml_request_' . $action)) {
         do_action_ref_array('tml_request_' . $action, array(&$this));
     } else {
         $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
         switch ($action) {
             case 'logout':
                 check_admin_referer('log-out');
                 $user = wp_get_current_user();
                 $redirect_to = apply_filters('logout_redirect', site_url('wp-login.php?loggedout=true'), isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
                 wp_logout();
                 wp_safe_redirect($redirect_to);
                 exit;
                 break;
             case 'lostpassword':
             case 'retrievepassword':
                 $this->check_ssl();
                 if ($http_post) {
                     $errors = $this->retrieve_password();
                     if (!is_wp_error($errors)) {
                         $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : Theme_My_Login::get_current_url('checkemail=confirm');
                         if (!empty($instance)) {
                             $redirect_to = add_query_arg('instance', $instance, $redirect_to);
                         }
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                 }
                 if (isset($_REQUEST['error']) && 'invalidkey' == $_REQUEST['error']) {
                     $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'theme-my-login'));
                 }
                 break;
             case 'resetpass':
             case 'rp':
                 $this->check_ssl();
                 $user = $this->check_password_reset_key($_REQUEST['key'], $_REQUEST['login']);
                 if (is_wp_error($user)) {
                     wp_redirect(Theme_My_Login::get_current_url('action=lostpassword&error=invalidkey'));
                     exit;
                 }
                 $errors = '';
                 if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) {
                     $errors = new WP_Error('password_reset_mismatch', __('Your passwords do not match.', 'theme-my-login'));
                 } elseif (isset($_POST['pass1']) && !empty($_POST['pass1'])) {
                     $this->reset_password($user, $_POST['pass1']);
                     $redirect_to = Theme_My_Login::get_current_url('resetpass=complete');
                     if (isset($_REQUEST['instance']) & !empty($_REQUEST['instance'])) {
                         $redirect_to = add_query_arg('instance', $_REQUEST['instance'], $redirect_to);
                     }
                     wp_safe_redirect($redirect_to);
                     exit;
                 }
                 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
                 wp_enqueue_script('user-profile', admin_url("js/user-profile{$suffix}.js"), array('jquery'), '', true);
                 wp_enqueue_script('password-strength-meter', admin_url("js/password-strength-meter{$suffix}.js"), array('jquery'), '', true);
                 wp_localize_script('password-strength-meter', 'pwsL10n', array('empty' => __('Strength indicator', 'theme-my-login'), 'short' => __('Very weak', 'theme-my-login'), 'bad' => __('Weak', 'theme-my-login'), 'good' => _x('Medium', 'password strength', 'theme-my-login'), 'strong' => __('Strong', 'theme-my-login'), 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'));
                 break;
             case 'register':
                 if (!get_option('users_can_register')) {
                     wp_redirect(Theme_My_Login::get_current_url('registration=disabled'));
                     exit;
                 }
                 $this->check_ssl();
                 $user_login = '';
                 $user_email = '';
                 if ($http_post) {
                     if (version_compare($GLOBALS['wp_version'], '3.1', '<')) {
                         require_once ABSPATH . WPINC . '/registration.php';
                     }
                     $user_login = $_POST['user_login'];
                     $user_email = $_POST['user_email'];
                     $errors = Theme_My_Login::register_new_user($user_login, $user_email);
                     if (!is_wp_error($errors)) {
                         $redirect_to = !empty($_POST['redirect_to']) ? $_POST['redirect_to'] : Theme_My_Login::get_current_url('checkemail=registered');
                         if (!empty($instance)) {
                             $redirect_to = add_query_arg('instance', $instance, $redirect_to);
                         }
                         $redirect_to = apply_filters('register_redirect', $redirect_to);
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                 }
                 break;
             case 'login':
             default:
                 $secure_cookie = '';
                 $interim_login = isset($_REQUEST['interim-login']);
                 // If the user wants ssl but the session is not ssl, force a secure cookie.
                 if (!empty($_POST['log']) && !force_ssl_admin()) {
                     $user_name = sanitize_user($_POST['log']);
                     if ($user = get_userdatabylogin($user_name)) {
                         if (get_user_option('use_ssl', $user->ID)) {
                             $secure_cookie = true;
                             force_ssl_admin(true);
                         }
                     }
                 }
                 if (isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to'])) {
                     $redirect_to = $_REQUEST['redirect_to'];
                     // Redirect to https if user wants ssl
                     if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
                         $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
                     }
                 } else {
                     $redirect_to = admin_url();
                 }
                 $reauth = empty($_REQUEST['reauth']) ? false : true;
                 // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
                 // cookie and redirect back to the referring non-secure admin page.  This allows logins to always be POSTed over SSL while allowing the user to choose visiting
                 // the admin via http or https.
                 if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
                     $secure_cookie = false;
                 }
                 if ($http_post && isset($_POST['log'])) {
                     $this->check_ssl();
                     // Set a cookie now to see if they are supported by the browser.
                     setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
                     if (SITECOOKIEPATH != COOKIEPATH) {
                         setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
                     }
                     $user = wp_signon('', $secure_cookie);
                     $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
                     if (!is_wp_error($user) && !$reauth) {
                         // If the user can't edit posts, send them to their profile.
                         if (!$user->has_cap('edit_posts') && (empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url())) {
                             $redirect_to = admin_url('profile.php');
                         }
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                     $errors = $user;
                 }
                 $this->redirect_to = $redirect_to;
                 // Clear errors if loggedout is set.
                 if (!empty($_GET['loggedout']) || $reauth) {
                     $errors = new WP_Error();
                 }
                 // If cookies are disabled we can't log in even with a valid user+pass
                 if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
                     $errors->add('test_cookie', __('<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="http://www.google.com/cookies.html">enable cookies</a> to use WordPress.', 'theme-my-login'));
                 }
                 // Some parts of this script use the main login form to display a message
                 if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
                     $errors->add('loggedout', __('You are now logged out.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
                     $errors->add('registerdisabled', __('User registration is currently not allowed.', 'theme-my-login'));
                 } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
                     $errors->add('confirm', __('Check your e-mail for the confirmation link.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['resetpass']) && 'complete' == $_GET['resetpass']) {
                     $errors->add('password_reset', __('Your password has been reset.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
                     $errors->add('registered', __('Registration complete. Please check your e-mail.', 'theme-my-login'), 'message');
                 } elseif ($interim_login) {
                     $errors->add('expired', __('Your session has expired. Please log-in again.', 'theme-my-login'), 'message');
                 } elseif ($reauth) {
                     $errors->add('reauth', __('Please log in to continue.', 'theme-my-login'), 'message');
                 }
                 // Clear any stale cookies.
                 if ($reauth) {
                     wp_clear_auth_cookie();
                 }
                 break;
         }
         // end switch
     }
     // endif has_filter()
 }
示例#3
0
 /**
  * Proccesses the request
  *
  * Callback for "parse_request" hook in WP::parse_request()
  *
  * @see WP::parse_request()
  * @since 6.0
  * @access public
  */
 function parse_request(&$wp)
 {
     $errors =& $this->errors;
     $action =& $this->request_action;
     if (isset($wp->query_vars['action'])) {
         $action = $wp->query_vars['action'];
         unset($wp->query_vars['action']);
     }
     $instance =& $this->request_instance;
     if (is_admin()) {
         return;
     }
     do_action_ref_array('tml_request', array(&$this));
     // allow plugins to override the default actions, and to add extra actions if they want
     do_action('login_form_' . $action);
     if (has_action('tml_request_' . $action)) {
         do_action_ref_array('tml_request_' . $action, array(&$this));
     } else {
         $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
         switch ($action) {
             case 'postpass':
                 global $wp_hasher;
                 if (empty($wp_hasher)) {
                     require_once ABSPATH . 'wp-includes/class-phpass.php';
                     // By default, use the portable hash from phpass
                     $wp_hasher = new PasswordHash(8, true);
                 }
                 // 10 days
                 setcookie('wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword(stripslashes($_POST['post_password'])), time() + 864000, COOKIEPATH);
                 wp_safe_redirect(wp_get_referer());
                 exit;
                 break;
             case 'logout':
                 check_admin_referer('log-out');
                 $user = wp_get_current_user();
                 wp_logout();
                 $redirect_to = apply_filters('logout_redirect', site_url('wp-login.php?loggedout=true'), isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
                 wp_safe_redirect($redirect_to);
                 exit;
                 break;
             case 'lostpassword':
             case 'retrievepassword':
                 if ($http_post) {
                     $errors = $this->retrieve_password();
                     if (!is_wp_error($errors)) {
                         $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : Theme_My_Login::get_current_url('checkemail=confirm');
                         if (!empty($instance)) {
                             $redirect_to = add_query_arg('instance', $instance, $redirect_to);
                         }
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                 }
                 if (isset($_REQUEST['error']) && 'invalidkey' == $_REQUEST['error']) {
                     $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'theme-my-login'));
                 }
                 do_action('lost_password');
                 break;
             case 'resetpass':
             case 'rp':
                 $user = $this->check_password_reset_key($_REQUEST['key'], $_REQUEST['login']);
                 if (is_wp_error($user)) {
                     wp_redirect(Theme_My_Login::get_current_url('action=lostpassword&error=invalidkey'));
                     exit;
                 }
                 $errors = '';
                 if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) {
                     $errors = new WP_Error('password_reset_mismatch', __('The passwords do not match.', 'theme-my-login'));
                 } elseif (isset($_POST['pass1']) && !empty($_POST['pass1'])) {
                     $this->reset_password($user, $_POST['pass1']);
                     $redirect_to = Theme_My_Login::get_current_url('resetpass=complete');
                     if (isset($_REQUEST['instance']) & !empty($_REQUEST['instance'])) {
                         $redirect_to = add_query_arg('instance', $_REQUEST['instance'], $redirect_to);
                     }
                     wp_safe_redirect($redirect_to);
                     exit;
                 }
                 wp_enqueue_script('utils');
                 wp_enqueue_script('user-profile');
                 break;
             case 'register':
                 if (!get_option('users_can_register')) {
                     wp_redirect(Theme_My_Login::get_current_url('registration=disabled'));
                     exit;
                 }
                 $user_login = '';
                 $user_email = '';
                 if ($http_post) {
                     $user_login = $_POST['user_login'];
                     $user_email = $_POST['user_email'];
                     $errors = Theme_My_Login::register_new_user($user_login, $user_email);
                     if (!is_wp_error($errors)) {
                         $redirect_to = !empty($_POST['redirect_to']) ? $_POST['redirect_to'] : Theme_My_Login::get_current_url('checkemail=registered');
                         if (!empty($instance)) {
                             $redirect_to = add_query_arg('instance', $instance, $redirect_to);
                         }
                         $redirect_to = apply_filters('register_redirect', $redirect_to);
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                 }
                 break;
             case 'login':
             default:
                 $secure_cookie = '';
                 $interim_login = isset($_REQUEST['interim-login']);
                 // If the user wants ssl but the session is not ssl, force a secure cookie.
                 if (!empty($_POST['log']) && !force_ssl_admin()) {
                     $user_name = sanitize_user($_POST['log']);
                     if ($user = get_user_by('login', $user_name)) {
                         if (get_user_option('use_ssl', $user->ID)) {
                             $secure_cookie = true;
                             force_ssl_admin(true);
                         }
                     }
                 }
                 if (!empty($_REQUEST['redirect_to'])) {
                     $redirect_to = $_REQUEST['redirect_to'];
                     // Redirect to https if user wants ssl
                     if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
                         $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
                     }
                 } else {
                     $redirect_to = admin_url();
                 }
                 $reauth = empty($_REQUEST['reauth']) ? false : true;
                 // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
                 // cookie and redirect back to the referring non-secure admin page.  This allows logins to always be POSTed over SSL while allowing the user to choose visiting
                 // the admin via http or https.
                 if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
                     $secure_cookie = false;
                 }
                 if ($http_post && isset($_POST['log'])) {
                     // Set a cookie now to see if they are supported by the browser.
                     setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
                     if (SITECOOKIEPATH != COOKIEPATH) {
                         setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
                     }
                     $user = wp_signon('', $secure_cookie);
                     $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
                     if (!is_wp_error($user) && !$reauth) {
                         if (empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url()) {
                             // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
                             if (is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin($user->ID)) {
                                 $redirect_to = user_admin_url();
                             } elseif (is_multisite() && !$user->has_cap('read')) {
                                 $redirect_to = get_dashboard_url($user->ID);
                             } elseif (!$user->has_cap('edit_posts')) {
                                 $redirect_to = admin_url('profile.php');
                             }
                         }
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                     $errors = $user;
                 }
                 $this->redirect_to = $redirect_to;
                 // Clear errors if loggedout is set.
                 if (!empty($_GET['loggedout']) || $reauth) {
                     $errors = new WP_Error();
                 }
                 // If cookies are disabled we can't log in even with a valid user+pass
                 if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
                     $errors->add('test_cookie', __('<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="http://www.google.com/cookies.html">enable cookies</a> to use WordPress.', 'theme-my-login'));
                 }
                 // Some parts of this script use the main login form to display a message
                 if (isset($_GET['loggedout']) && true == $_GET['loggedout']) {
                     $errors->add('loggedout', __('You are now logged out.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
                     $errors->add('registerdisabled', __('User registration is currently not allowed.', 'theme-my-login'));
                 } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
                     $errors->add('confirm', __('Check your e-mail for the confirmation link.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['resetpass']) && 'complete' == $_GET['resetpass']) {
                     $errors->add('password_reset', __('Your password has been reset.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
                     $errors->add('registered', __('Registration complete. Please check your e-mail.', 'theme-my-login'), 'message');
                 } elseif ($interim_login) {
                     $errors->add('expired', __('Your session has expired. Please log-in again.', 'theme-my-login'), 'message');
                 } elseif (strpos($redirect_to, 'about.php?updated')) {
                     $errors->add('updated', __('<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.'), 'message');
                 } elseif ($reauth) {
                     $errors->add('reauth', __('Please log in to continue.', 'theme-my-login'), 'message');
                 }
                 // Clear any stale cookies.
                 if ($reauth) {
                     wp_clear_auth_cookie();
                 }
                 break;
         }
         // end switch
     }
     // endif has_filter()
 }
示例#4
0
 /**
  * Handles "send_activation" action for login page
  *
  * Callback for "tml_request_send_activation" hook in method Theme_My_Login::the_request();
  *
  * @see Theme_My_Login::the_request();
  * @since 6.0
  * @access public
  */
 function send_activation()
 {
     global $theme_my_login, $wpdb;
     $login = isset($_GET['login']) ? trim($_GET['login']) : '';
     if (!($user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->users} WHERE user_login = %s", $login)))) {
         $redirect_to = Theme_My_Login::get_current_url('sendactivation=failed');
         if (!empty($theme_my_login->request_instance)) {
             $redirect_to = add_query_arg('instance', $theme_my_login->request_instance, $redirect_to);
         }
         wp_redirect($redirect_to);
         exit;
     }
     $user = new WP_User($user_id);
     if (in_array('pending', (array) $user->roles)) {
         // Send activation e-mail
         $this->new_user_activation_notification($user->ID);
         // Now redirect them
         $redirect_to = Theme_My_Login::get_current_url('sendactivation=sent');
         wp_redirect($redirect_to);
         exit;
     }
 }
        /**
         * Displays the registration page
         *
         * @since 6.1
         * @access public
         *
         * @param object $template Theme_My_Login_Template object
         */
        function tml_display_register(&$template)
        {
            global $theme_my_login, $wpdb, $blogname, $blog_title, $domain, $path, $active_signup;
            $this->theme_my_login_template =& $template;
            do_action('before_signup_form');
            echo '<div class="login mu_register" id="theme-my-login' . esc_attr($template->instance) . '">';
            $active_signup = get_site_option('registration');
            if (!$active_signup) {
                $active_signup = 'all';
            }
            $active_signup = apply_filters('wpmu_active_signup', $active_signup);
            // return "all", "none", "blog" or "user"
            // Make the signup type translatable.
            $i18n_signup['all'] = _x('all', 'Multisite active signup type');
            $i18n_signup['none'] = _x('none', 'Multisite active signup type');
            $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
            $i18n_signup['user'] = _x('user', 'Multisite active signup type');
            if (is_super_admin()) {
                echo '<p class="message">' . sprintf(__('Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.'), $i18n_signup[$active_signup], esc_url(network_admin_url('ms-options.php'))) . '</p>';
            }
            $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
            $current_user = wp_get_current_user();
            if ($active_signup == "none") {
                _e('Registration has been disabled.', 'theme-my-login');
            } elseif ($active_signup == 'blog' && !is_user_logged_in()) {
                printf(__('You must first <a href="%s">log in</a>, and then you can create a new site.', 'theme-my-login'), wp_login_url(Theme_My_Login::get_current_url()));
            } else {
                $stage = isset($_POST['stage']) ? $_POST['stage'] : 'default';
                switch ($stage) {
                    case 'validate-user-signup':
                        if ($active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user') {
                            $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
                            extract($result);
                            $theme_my_login->errors = $errors;
                            if ($errors->get_error_code()) {
                                $this->signup_user($user_name, $user_email);
                                break;
                            }
                            if ('blog' == $_POST['signup_for']) {
                                $this->signup_blog($user_name, $user_email);
                                break;
                            }
                            wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array()));
                            ?>
						<h2><?php 
                            printf(__('%s is your new username', 'theme-my-login'), $user_name);
                            ?>
</h2>
						<p><?php 
                            _e('But, before you can start using your new username, <strong>you must activate it</strong>.', 'theme-my-login');
                            ?>
</p>
						<p><?php 
                            printf(__('Check your inbox at <strong>%1$s</strong> and click the link given.', 'theme-my-login'), $user_email);
                            ?>
</p>
						<p><?php 
                            _e('If you do not activate your username within two days, you will have to sign up again.', 'theme-my-login');
                            ?>
</p>
						<?php 
                            do_action('signup_finished');
                        } else {
                            _e('User registration has been disabled.', 'theme-my-login');
                        }
                        break;
                    case 'validate-blog-signup':
                        if ($active_signup == 'all' || $active_signup == 'blog') {
                            // Re-validate user info.
                            $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
                            extract($result);
                            $theme_my_login->errors = $errors;
                            if ($errors->get_error_code()) {
                                $this->signup_user($user_name, $user_email);
                                break;
                            }
                            $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
                            extract($result);
                            $theme_my_login->errors = $errors;
                            if ($errors->get_error_code()) {
                                $this->signup_blog($user_name, $user_email, $blogname, $blog_title);
                                break;
                            }
                            $public = (int) $_POST['blog_public'];
                            $meta = array('lang_id' => 1, 'public' => $public);
                            $meta = apply_filters('add_signup_meta', $meta);
                            wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
                            ?>
						<h2><?php 
                            printf(__('Congratulations! Your new site, %s, is almost ready.', 'theme-my-login'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>");
                            ?>
</h2>

						<p><?php 
                            _e('But, before you can start using your site, <strong>you must activate it</strong>.', 'theme-my-login');
                            ?>
</p>
						<p><?php 
                            printf(__('Check your inbox at <strong>%s</strong> and click the link given.', 'theme-my-login'), $user_email);
                            ?>
</p>
						<p><?php 
                            _e('If you do not activate your site within two days, you will have to sign up again.', 'theme-my-login');
                            ?>
</p>
						<h2><?php 
                            _e('Still waiting for your email?');
                            ?>
</h2>
						<p>
							<?php 
                            _e('If you haven&#8217;t received your email yet, there are a number of things you can do:', 'theme-my-login');
                            ?>
							<ul id="noemail-tips">
								<li><p><strong><?php 
                            _e('Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.', 'theme-my-login');
                            ?>
</strong></p></li>
								<li><p><?php 
                            _e('Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.', 'theme-my-login');
                            ?>
</p></li>
								<li><?php 
                            printf(__('Have you entered your email correctly?  You have entered %s, if it&#8217;s incorrect, you will not receive your email.', 'theme-my-login'), $user_email);
                            ?>
</li>
							</ul>
						</p>
						<?php 
                            do_action('signup_finished');
                        } else {
                            _e('Site registration has been disabled.', 'theme-my-login');
                        }
                        break;
                    case 'gimmeanotherblog':
                        $current_user = wp_get_current_user();
                        if (!is_user_logged_in()) {
                            die;
                        }
                        $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $current_user);
                        extract($result);
                        $theme_my_login->errors = $errors;
                        if ($errors->get_error_code()) {
                            $this->signup_another_blog($blogname, $blog_title);
                            break;
                        }
                        $public = (int) $_POST['blog_public'];
                        $meta = apply_filters('signup_create_blog_meta', array('lang_id' => 1, 'public' => $public));
                        // deprecated
                        $meta = apply_filters('add_signup_meta', $meta);
                        wpmu_create_blog($domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid);
                        ?>
					<h2><?php 
                        printf(__('The site %s is yours.', 'theme-my-login'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>");
                        ?>
</h2>
					<p>
						<?php 
                        printf(__('<a href="http://%1$s">http://%2$s</a> is your new site.  <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.', 'theme-my-login'), $domain . $path, $domain . $path, "http://" . $domain . $path . "wp-login.php", $current_user->user_login);
                        ?>
					</p>
					<?php 
                        do_action('signup_finished');
                        break;
                    case 'default':
                    default:
                        $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
                        do_action('preprocess_signup_form');
                        // populate the form from invites, elsewhere?
                        if (is_user_logged_in() && ($active_signup == 'all' || $active_signup == 'blog')) {
                            $this->signup_another_blog($newblogname);
                        } elseif (is_user_logged_in() == false && ($active_signup == 'all' || $active_signup == 'user')) {
                            $this->signup_user($newblogname, $user_email);
                        } elseif (is_user_logged_in() == false && $active_signup == 'blog') {
                            _e('Sorry, new registrations are not allowed at this time.', 'theme-my-login');
                        } else {
                            _e('You are logged in already. No need to register again!', 'theme-my-login');
                        }
                        if ($newblogname) {
                            $newblog = get_blogaddress_by_name($newblogname);
                            if ($active_signup == 'blog' || $active_signup == 'all') {
                                printf(__('<p><em>The site you were looking for, <strong>%s</strong> does not exist, but you can create it now!</em></p>', 'theme-my-login'), $newblog);
                            } else {
                                printf(__('<p><em>The site you were looking for, <strong>%s</strong>, does not exist.</em></p>', 'theme-my-login'), $newblog);
                            }
                        }
                        break;
                }
            }
            echo '</div>';
            do_action('after_signup_form');
        }