wp/wp-activate.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    25 $wp_query->is_404 = false;
    25 $wp_query->is_404 = false;
    26 
    26 
    27 /**
    27 /**
    28  * Fires before the Site Activation page is loaded.
    28  * Fires before the Site Activation page is loaded.
    29  *
    29  *
    30  * @since 3.0
    30  * @since 3.0.0
    31  */
    31  */
    32 do_action( 'activate_header' );
    32 do_action( 'activate_header' );
    33 
    33 
    34 /**
    34 /**
    35  * Adds an action hook specific to this page that fires on wp_head
    35  * Adds an action hook specific to this page that fires on wp_head
    38  */
    38  */
    39 function do_activate_header() {
    39 function do_activate_header() {
    40     /**
    40     /**
    41      * Fires before the Site Activation page is loaded, but on the wp_head action.
    41      * Fires before the Site Activation page is loaded, but on the wp_head action.
    42      *
    42      *
    43      * @since 3.0
    43      * @since 3.0.0
    44      */
    44      */
    45     do_action( 'activate_wp_head' );
    45     do_action( 'activate_wp_head' );
    46 }
    46 }
    47 add_action( 'wp_head', 'do_activate_header' );
    47 add_action( 'wp_head', 'do_activate_header' );
    48 
    48 
    82 		</form>
    82 		</form>
    83 
    83 
    84 	<?php } else {
    84 	<?php } else {
    85 
    85 
    86 		$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
    86 		$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
    87 		$result = wpmu_activate_signup($key);
    87 		$result = wpmu_activate_signup( $key );
    88 		if ( is_wp_error($result) ) {
    88 		if ( is_wp_error($result) ) {
    89 			if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
    89 			if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
    90 			    $signup = $result->get_error_data();
    90 			    $signup = $result->get_error_data();
    91 				?>
    91 				?>
    92 				<h2><?php _e('Your account is now active!'); ?></h2>
    92 				<h2><?php _e('Your account is now active!'); ?></h2>
   103 				<h2><?php _e('An error occurred during the activation'); ?></h2>
   103 				<h2><?php _e('An error occurred during the activation'); ?></h2>
   104 				<?php
   104 				<?php
   105 			    echo '<p>'.$result->get_error_message().'</p>';
   105 			    echo '<p>'.$result->get_error_message().'</p>';
   106 			}
   106 			}
   107 		} else {
   107 		} else {
   108 			extract($result);
   108 			$url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : '';
   109 			$url = get_blogaddress_by_id( (int) $blog_id);
   109 			$user = get_userdata( (int) $result['user_id'] );
   110 			$user = get_userdata( (int) $user_id);
       
   111 			?>
   110 			?>
   112 			<h2><?php _e('Your account is now active!'); ?></h2>
   111 			<h2><?php _e('Your account is now active!'); ?></h2>
   113 
   112 
   114 			<div id="signup-welcome">
   113 			<div id="signup-welcome">
   115 				<p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
   114 				<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 $password; ?></p>
   115 				<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
   117 			</div>
   116 			</div>
   118 
   117 
   119 			<?php if ( $url != network_home_url('', 'http') ) : ?>
   118 			<?php if ( $url && $url != network_home_url( '', 'http' ) ) : ?>
   120 				<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, $url . 'wp-login.php' ); ?></p>
   119 				<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, $url . 'wp-login.php' ); ?></p>
   121 			<?php else: ?>
   120 			<?php else: ?>
   122 				<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>
   121 				<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>
   123 			<?php endif;
   122 			<?php endif;
   124 		}
   123 		}
   127 </div>
   126 </div>
   128 <script type="text/javascript">
   127 <script type="text/javascript">
   129 	var key_input = document.getElementById('key');
   128 	var key_input = document.getElementById('key');
   130 	key_input && key_input.focus();
   129 	key_input && key_input.focus();
   131 </script>
   130 </script>
   132 <?php get_footer(); ?>
   131 <?php get_footer();