3 * Confirms that the activation key that is sent in an email after a user signs
4 * up for a new site matches the key for that user and then displays confirmation.
9 define( 'WP_INSTALLING', true );
11 /** Sets up the WordPress Environment. */
12 require( dirname(__FILE__) . '/wp-load.php' );
14 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
16 if ( !is_multisite() ) {
17 wp_redirect( wp_registration_url() );
21 if ( is_object( $wp_object_cache ) )
22 $wp_object_cache->cache_enabled = false;
25 $wp_query->is_404 = false;
28 * Fires before the Site Activation page is loaded.
32 do_action( 'activate_header' );
35 * Adds an action hook specific to this page that fires on wp_head
39 function do_activate_header() {
41 * Fires before the Site Activation page is loaded, but on the wp_head action.
45 do_action( 'activate_wp_head' );
47 add_action( 'wp_head', 'do_activate_header' );
50 * Loads styles specific to this page.
54 function wpmu_activate_stylesheet() {
56 <style type="text/css">
57 form { margin-top: 2em; }
58 #submit, #key { width: 90%; font-size: 24px; }
59 #language { margin-top: .5em; }
60 .error { background: #f66; }
61 span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: bold; }
65 add_action( 'wp_head', 'wpmu_activate_stylesheet' );
67 get_header( 'wp-activate' );
70 <div id="signup-content" class="widecolumn">
71 <div class="wp-activate-container">
72 <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
74 <h2><?php _e('Activation Key Required') ?></h2>
75 <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
77 <label for="key"><?php _e('Activation Key:') ?></label>
78 <br /><input type="text" name="key" id="key" value="" size="50" />
81 <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
87 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
88 $result = wpmu_activate_signup( $key );
89 if ( is_wp_error($result) ) {
90 if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
91 $signup = $result->get_error_data();
93 <h2><?php _e('Your account is now active!'); ?></h2>
95 echo '<p class="lead-in">';
96 if ( $signup->domain . $signup->path == '' ) {
97 printf( __('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, wp_lostpassword_url() );
99 printf( __('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url() );
104 <h2><?php _e('An error occurred during the activation'); ?></h2>
106 echo '<p>'.$result->get_error_message().'</p>';
109 $url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : '';
110 $user = get_userdata( (int) $result['user_id'] );
112 <h2><?php _e('Your account is now active!'); ?></h2>
114 <div id="signup-welcome">
115 <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
116 <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
119 <?php if ( $url && $url != network_home_url( '', 'http' ) ) :
120 switch_to_blog( (int) $result['blog_id'] );
121 $login_url = wp_login_url();
122 restore_current_blog();
124 <p class="view"><?php printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) ); ?></p>
126 <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
133 <script type="text/javascript">
134 var key_input = document.getElementById('key');
135 key_input && key_input.focus();
137 <?php get_footer( 'wp-activate' );