/** * Activates the module * * Callback for "tml_activate_themed-profiles/themed-profiles.php" hook in method Theme_My_Login_Modules_Admin::activate_module() * * @see Theme_My_Login_Modules_Admin::activate_module() * @since 6.0 * @access public */ public function activate() { if (!($page_id = Theme_My_Login::get_page_id('profile'))) { $page_id = wp_insert_post(array('post_title' => __('Your Profile'), 'post_status' => 'publish', 'post_type' => 'page', 'post_content' => '[theme-my-login]', 'comment_status' => 'closed', 'ping_status' => 'closed')); update_post_meta($page_id, '_tml_action', 'profile'); } }
/** * Displays the widget * * @since 6.0 * @access public * * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget */ public function widget($args, $instance) { $theme_my_login = Theme_My_Login::get_object(); $instance = wp_parse_args($instance, array('default_action' => 'login', 'logged_in_widget' => true, 'logged_out_widget' => true, 'show_title' => true, 'show_log_link' => true, 'show_reg_link' => true, 'show_pass_link' => true, 'show_gravatar' => true, 'gravatar_size' => 50)); // Show if logged in? if (is_user_logged_in() && !$instance['logged_in_widget']) { return; } // Show if logged out? if (!is_user_logged_in() && !$instance['logged_out_widget']) { return; } $args = array_merge($args, $instance); echo $theme_my_login->shortcode($args); }
/** * Adds "_wp_original_referer" field to login form * * Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display() * * @see Theme_My_Login_Template::display() * @since 6.0 * @access public */ public function login_form() { if (!empty($_REQUEST['redirect_to'])) { $referer = wp_unslash($_REQUEST['redirect_to']); } elseif (wp_get_original_referer()) { $referer = wp_get_original_referer(); } else { $referer = Theme_My_Login::is_tml_page() ? wp_get_referer() : wp_unslash($_SERVER['REQUEST_URI']); } echo '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr($referer) . '" />'; }
/** * Hide Profile link if user is not logged in * * Callback for "wp_setup_nav_menu_item" hook in wp_setup_nav_menu_item() * * @see wp_setup_nav_menu_item() * @since 6.4 * @access public * * @param object $menu_item The menu item * @return object The (possibly) modified menu item */ public function wp_setup_nav_menu_item($menu_item) { if (is_admin()) { return $menu_item; } if ('page' != $menu_item->object) { return $menu_item; } // User is not logged in if (!is_user_logged_in()) { // Hide Profile if (Theme_My_Login::is_tml_page('profile', $menu_item->object_id)) { $menu_item->_invalid = true; } } return $menu_item; }
/** * 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); }
/** * Changes links from "profile.php" to themed profile page * * Callback for "site_url" hook * * @see site_url() * @since 6.0 * @access public * * @param string $url The generated link * @param string $path The specified path * @param string $orig_scheme The original connection scheme * @return string The filtered link */ public function site_url($url, $path, $orig_scheme = '') { global $current_user, $pagenow; if ('profile.php' != $pagenow && strpos($url, 'profile.php') !== false) { $user_role = reset($current_user->roles); if (is_multisite() && empty($user_role)) { $user_role = 'subscriber'; } if ($user_role && !$this->get_option(array($user_role, 'theme_profile'))) { return $url; } $parsed_url = parse_url($url); $url = Theme_My_Login::get_page_link('profile'); if (isset($parsed_url['query'])) { $url = add_query_arg(array_map('rawurlencode', wp_parse_args($parsed_url['query'])), $url); } } return $url; }
/** * Adds CSS class to TML pages * * @since 6.3 * @access public * * @param object $menu_item Nav menu item * @return object Nav menu item */ public function wp_setup_nav_menu_item($menu_item) { if ('tml_page' == $menu_item->object && Theme_My_Login::is_tml_page('', $menu_item->object_id)) { if (!is_user_logged_in()) { $menu_item->classes[] = 'tml_ajax_link'; } } return $menu_item; }
/** * Installs TML * * @since 6.0 * @access public */ public function install() { global $wpdb; // Current version $version = $this->get_option('version', Theme_My_Login::version); // Check if legacy page exists if ($page_id = $this->get_option('page_id')) { $page = get_post($page_id); } else { $page = get_page_by_title('Login'); } // 4.4 upgrade if (version_compare($version, '4.4', '<')) { remove_role('denied'); } // 6.0 upgrade if (version_compare($version, '6.0', '<')) { // Replace shortcode if ($page) { $page->post_content = str_replace('[theme-my-login-page]', '[theme-my-login]', $page->post_content); wp_update_post($page); } } // 6.3 upgrade if (version_compare($version, '6.3.3', '<')) { // Delete obsolete options $this->delete_option('page_id'); $this->delete_option('show_page'); $this->delete_option('initial_nag'); $this->delete_option('permalinks'); $this->delete_option('flush_rules'); // Move options to their own rows foreach ($this->get_options() as $key => $value) { if (in_array($key, array('active_modules'))) { continue; } if (!is_array($value)) { continue; } update_option("theme_my_login_{$key}", $value); $this->delete_option($key); } // Maybe create login page? if ($page) { // Make sure the page is not in the trash if ('trash' == $page->post_status) { wp_untrash_post($page->ID); } update_post_meta($page->ID, '_tml_action', 'login'); } } // 6.3.7 upgrade if (version_compare($version, '6.3.7', '<')) { // Convert TML pages to regular pages $wpdb->update($wpdb->posts, array('post_type' => 'page'), array('post_type' => 'tml_page')); // Get rid of stale rewrite rules flush_rewrite_rules(false); } // 6.4 upgrade if (version_compare($version, '6.4', '<')) { // Convert e-mail login option if ($this->get_option('email_login')) { $this->set_option('login_type', 'both'); } $this->delete_option('email_login'); } // Setup default pages foreach (Theme_My_Login::default_pages() as $action => $title) { if (!($page_id = Theme_My_Login::get_page_id($action))) { $page_id = wp_insert_post(array('post_title' => $title, 'post_name' => $action, 'post_status' => 'publish', 'post_type' => 'page', 'post_content' => '[theme-my-login]', 'comment_status' => 'closed', 'ping_status' => 'closed')); update_post_meta($page_id, '_tml_action', $action); } } // Activate modules foreach ($this->get_option('active_modules', array()) as $module) { if (file_exists(WP_PLUGIN_DIR . '/theme-my-login/modules/' . $module)) { include_once WP_PLUGIN_DIR . '/theme-my-login/modules/' . $module; } do_action('tml_activate_' . $module); } $this->set_option('version', Theme_My_Login::version); $this->save_options(); }
/** * Rewrites URL's created by network_site_url * * @since 6.3 * @access public * * @param string $url The URL * @param string $path The path specified * @param string $orig_scheme The current connection scheme (HTTP/HTTPS) * @return string The modified URL */ public function network_site_url($url, $path, $orig_scheme) { global $current_site; $url = $this->site_url($url, $path, $orig_scheme); switch_to_blog(1); $url = Theme_My_Login::get_object()->site_url($url, $path, $orig_scheme, $current_site->blog_id); restore_current_blog(); return $url; }
/** * Changes the user approval e-mail message * * Callback for "user_approval_notification_message" hook in Theme_My_Login_User_Moderation_Admin::approve_user() * * @see Theme_My_Login_User_Moderation_Admin::approve_user() * @since 6.1 * @access public * * @param string $title The default message * @param string $key The user's reset key * @param int $user_id The user's ID * @return string The filtered message */ public function user_approval_notification_message_filter($message, $key, $user_id) { $_message = $this->get_option(array('user_approval', 'message')); if (!empty($_message)) { $user = get_user_by('id', $user_id); $message = Theme_My_Login_Common::replace_vars($_message, $user_id, array('%loginurl%' => Theme_My_Login::get_object()->get_page_link('login'), '%reseturl%' => site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user->user_login), 'login'))); } return $message; }
/** * Merges arrays recursively, replacing duplicate string keys * * @since 6.0 * @access public */ function array_merge_recursive() { $args = func_get_args(); $result = array_shift($args); foreach ($args as $arg) { foreach ($arg as $key => $value) { // Renumber numeric keys as array_merge() does. if (is_numeric($key)) { if (!in_array($value, $result)) { $result[] = $value; } } elseif (array_key_exists($key, $result) && is_array($result[$key]) && is_array($value)) { $result[$key] = Theme_My_Login::array_merge_recursive($result[$key], $value); } else { $result[$key] = $value; } } } return $result; }
/** * 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; } }
/** * @since 2.5.2 * @return true on Themed My Login - Themed Registration page */ function cimy_uef_is_theme_my_login_register_page() { // Theme My Login <= v6.2.x if (!empty($GLOBALS['theme_my_login']) && $GLOBALS['theme_my_login']->is_login_page()) { return true; } // Theme My Login >= v6.3.0 if (function_exists('Theme_My_Login') && Theme_My_Login::is_tml_page('register')) { return true; } return false; }
/** * Adds "_wp_original_referer" field to login form * * Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display() * * @see Theme_My_Login_Template::display() * @since 6.0 * @access public */ public function login_form() { echo wp_original_referer_field(false, Theme_My_Login::is_tml_page() ? 'previous' : 'current') . "\n"; }
/** * Adds "_wp_original_referer" field to login form * * Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display() * * @see Theme_My_Login_Template::display() * @since 6.0 * @access public */ public function login_form() { $template = Theme_My_Login::get_object()->get_active_instance(); echo wp_original_referer_field(false, $template->get_option('instance') ? 'current' : 'previous') . "\n"; }
/** * Blocks "pending" users from loggin in * * Callback for "authenticate" hook in function wp_authenticate() * * @see wp_authenticate() * @since 6.0 * @access public * * @param WP_User $user WP_User object * @param string $username Username posted * @param string $password Password posted * @return WP_User|WP_Error WP_User if the user can login, WP_Error otherwise */ public function authenticate($user, $username, $password) { global $wpdb; $cap_key = $wpdb->prefix . 'capabilities'; if ($userdata = get_user_by('login', $username)) { if (array_key_exists('pending', (array) $userdata->{$cap_key})) { if ('email' == $this->get_option('type')) { return new WP_Error('pending', sprintf(__('<strong>ERROR</strong>: You have not yet confirmed your e-mail address. <a href="%s">Resend activation</a>?', 'theme-my-login'), Theme_My_Login::get_page_link('login', array('action' => 'sendactivation', 'login' => $username)))); } else { return new WP_Error('pending', __('<strong>ERROR</strong>: Your registration has not yet been approved.', 'theme-my-login')); } } } return $user; }
/** * Blocks entire site if user is not logged in and private site is enabled * * Callback for "template_redirect" hook in the file wp-settings.php * * @since 6.2 * @access public */ public function template_redirect() { if ($this->get_option('private_site')) { if (!(is_user_logged_in() || Theme_My_Login::is_tml_page())) { $redirect_to = apply_filters('tml_security_private_site_redirect', wp_login_url($_SERVER['REQUEST_URI'], true)); wp_safe_redirect($redirect_to); exit; } } }
function pmpro_login_head() { $login_redirect = apply_filters("pmpro_login_redirect", true); if ((pmpro_is_login_page() || is_page("login") || class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0 && (Theme_My_Login::is_tml_page("register") || Theme_My_Login::is_tml_page("login"))) && $login_redirect) { //redirect registration page to levels page if (isset($_REQUEST['action']) && $_REQUEST['action'] == "register" || isset($_REQUEST['registration']) && $_REQUEST['registration'] == "disabled" || !is_admin() && class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0 && Theme_My_Login::is_tml_page("register")) { //redirect to levels page unless filter is set. $link = apply_filters("pmpro_register_redirect", pmpro_url("levels")); if (!empty($link)) { wp_redirect($link); exit; } else { return; } //don't redirect if pmpro_register_redirect filter returns false or a blank URL } //if theme my login is installed, redirect all logins to the login page if (pmpro_is_plugin_active("theme-my-login/theme-my-login.php")) { //check for the login page id and redirect there if we're not there already global $post; if (!empty($GLOBALS['theme_my_login']) && is_array($GLOBALS['theme_my_login']->options)) { //an older version of TML stores it this way if ($GLOBALS['theme_my_login']->options['page_id'] !== $post->ID) { //redirect to the real login page $link = get_permalink($GLOBALS['theme_my_login']->options['page_id']); if ($_SERVER['QUERY_STRING']) { $link .= "?" . $_SERVER['QUERY_STRING']; } wp_redirect($link); exit; } } elseif (!empty($GLOBALS['theme_my_login']->options)) { //another older version of TML stores it this way if ($GLOBALS['theme_my_login']->options->options['page_id'] !== $post->ID) { //redirect to the real login page $link = get_permalink($GLOBALS['theme_my_login']->options->options['page_id']); if ($_SERVER['QUERY_STRING']) { $link .= "?" . $_SERVER['QUERY_STRING']; } wp_redirect($link); exit; } } elseif (class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0) { //TML > 6.3 $link = Theme_My_Login::get_page_link("login"); if (!empty($link)) { //redirect if !is_page(), i.e. we're on wp-login.php if (!Theme_My_Login::is_tml_page()) { wp_redirect($link); exit; } } } //make sure users are only getting to the profile when logged in global $current_user; if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "profile" && !$current_user->ID) { $link = get_permalink($GLOBALS['theme_my_login']->options->options['page_id']); wp_redirect($link); exit; } } } }
/** * Sanitizes TML settings * * This is the callback for register_setting() * * @since 6.0 * @access public * * @param string|array $settings Settings passed in from filter * @return string|array Sanitized settings */ function save_settings($settings) { global $theme_my_login; // Sanitize new settings $settings['page_id'] = absint($settings['page_id']); $settings['show_page'] = isset($settings['show_page']); $settings['enable_css'] = isset($settings['enable_css']); $settings['email_login'] = isset($settings['email_login']); $modules = isset($_POST['theme_my_login_modules']) ? $_POST['theme_my_login_modules'] : array(); // If we have modules to activate if ($activate = array_diff((array) $modules, (array) $theme_my_login->options->get_option('active_modules'))) { // Attempt to activate them $result = $this->activate_modules($activate); // Check for WP_Error if (is_wp_error($result)) { // Loop through each module in the WP_Error object foreach ($result->get_error_data('modules_invalid') as $module => $wp_error) { // Store the module and error message to a temporary array which will be passed to 'admin_notices' if (is_wp_error($wp_error)) { $theme_my_login->options->options['module_errors'][$module] = $wp_error->get_error_message(); } } } } // If we have modules to deactivate if ($deactivate = array_diff((array) $theme_my_login->options->get_option('active_modules'), $modules)) { // Deactive them $this->deactivate_modules($deactivate); } // Flush permalinks if they have changed if (isset($settings['permalinks'])) { foreach ($settings['permalinks'] as $action => $slug) { if ($slug !== $theme_my_login->options->get_option(array('permalinks', $action))) { $settings['flush_rules'] = true; break; } } } // Merge current settings $settings = Theme_My_Login::array_merge_recursive($theme_my_login->options->options, $settings); // Allow plugins/modules to add/modify settings $settings = apply_filters('tml_save_settings', $settings); return $settings; }
/** * Returns the proper redirect URL according to action * * @since 6.0 * @access public * * @param string $action The action * @return string The redirect URL */ public function get_redirect_url($action = '') { $theme_my_login = Theme_My_Login::get_object(); if (empty($action)) { $action = $this->get_option('default_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_page_link('login', 'checkemail=confirm')); break; case 'register': $url = apply_filters('registration_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_page_link('login', '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); }
/** * Displays a TML instance * * @see Theme_My_Login::shortcode() for $args parameters * @since 6.0 * * @param string|array $args Template tag arguments */ function theme_my_login($args = '') { echo Theme_My_Login::get_object()->shortcode(wp_parse_args($args)); }
/** * Outputs password fields to multisite signup user form * * Callback for "signup_extra_fields" hook in file "ms-signup-user-form.php", included by Theme_My_Login_Template::display() * * @see Theme_My_Login::display() * @since 6.1 * @access public */ public function ms_password_fields() { $theme_my_login = Theme_My_Login::get_object(); $template = $theme_my_login->get_active_instance(); $errors = array(); foreach ($theme_my_login->errors->get_error_codes() as $code) { if (in_array($code, array('empty_password', 'password_mismatch', 'password_length'))) { $errors[] = $theme_my_login->errors->get_error_message($code); } } ?> <label for="pass1<?php $template->the_instance(); ?> "><?php _e('Password:'******'theme-my-login'); ?> </label> <?php if (!empty($errors)) { ?> <p class="error"><?php echo implode('<br />', $errors); ?> </p> <?php } ?> <input autocomplete="off" name="pass1" id="pass1<?php $template->the_instance(); ?> " class="input" size="20" value="" type="password" /><br /> <span class="hint"><?php echo apply_filters('tml_password_hint', __('(Must be at least 6 characters.)', 'theme-my-login')); ?> </span> <label for="pass2<?php $template->the_instance(); ?> "><?php _e('Confirm Password:'******'theme-my-login'); ?> </label> <input autocomplete="off" name="pass2" id="pass2<?php $template->the_instance(); ?> " class="input" size="20" value="" type="password" /><br /> <span class="hint"><?php echo apply_filters('tml_password_confirm_hint', __('Confirm that you\'ve typed your password correctly.', 'theme-my-login')); ?> </span> <?php }
/** * Changes the user approval e-mail message * * Callback for "user_approval_notification_message" hook in Theme_My_Login_User_Moderation_Admin::approve_user() * * @see Theme_My_Login_User_Moderation_Admin::approve_user() * @since 6.1 * @access public * * @param string $title The default message * @param string $new_pass The user's new password * @param int $user_id The user's ID * @return string The filtered message */ public function user_approval_notification_message_filter($message, $new_pass, $user_id) { $_message = $this->get_option(array('user_approval', 'message')); if (!empty($_message)) { $message = Theme_My_Login_Common::replace_vars($_message, $user_id, array('%loginurl%' => Theme_My_Login::get_object()->get_page_link('login'), '%user_pass%' => $new_pass)); } return $message; }
function kleo_maintenance_mode() { $logo_path = apply_filters('kleo_logo', sq_option_url('logo')); $logo_img = '<img src="' . $logo_path . '" alt="maintenance" style="margin: 0 auto; display: block;" />'; if (sq_option('maintenance_mode', 0) == 1) { /* Theme My Login compatibility */ if (class_exists('Theme_My_Login') && Theme_My_Login::is_tml_page('login')) { return; } if (!current_user_can('edit_themes') || !is_user_logged_in()) { wp_die($logo_img . '<div style="text-align:center">' . sq_option('maintenance_msg', '') . '</div>', get_bloginfo('name')); } } }
/** * 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 “%s” 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’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’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 “%4$s” 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'); }