[ Index ]

PHP Cross Reference of Documentation Wordpress

title

Body

[close]

/ -> wp-activate.php (source)

   1  <?php
   2  /**
   3   * Confirms that the activation key that is sent in an email after a user signs
   4   * up for a new blog matches the key for that user and then displays confirmation.
   5   *
   6   * @package WordPress
   7   */
   8  
   9  /** Define ABSPATH as this file's directory */
  10  define( 'WP_INSTALLING', true );
  11  
  12  /** Sets up the WordPress Environment. */
  13  require( dirname(__FILE__) . '/wp-load.php' );
  14  
  15  require ( './wp-blog-header.php' );
  16  
  17  if ( !is_multisite() ) {
  18      wp_redirect( site_url( '/wp-login.php?action=register' ) );
  19      die();
  20  }
  21  
  22  if ( is_object( $wp_object_cache ) )
  23      $wp_object_cache->cache_enabled = false;
  24  
  25  do_action( 'activate_header' );
  26  
  27  /**
  28   * Adds an action hook specific to this page that fires on wp_head
  29   *
  30   * @since MU
  31   */
  32  function do_activate_header() {
  33      do_action( 'activate_wp_head' );
  34  }
  35  add_action( 'wp_head', 'do_activate_header' );
  36  
  37  /**
  38   * Loads styles specific to this page.
  39   *
  40   * @since MU
  41   */
  42  function wpmu_activate_stylesheet() {
  43      ?>
  44      <style type="text/css">
  45          form { margin-top: 2em; }
  46          #submit, #key { width: 90%; font-size: 24px; }
  47          #language { margin-top: .5em; }
  48          .error { background: #f66; }
  49          span.h3 { padding: 0 8px; font-size: 1.3em; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; font-weight: bold; color: #333; }
  50      </style>
  51      <?php
  52  }
  53  add_action( 'wp_head', 'wpmu_activate_stylesheet' );
  54  
  55  get_header();
  56  ?>
  57  
  58  <div id="content" class="widecolumn">
  59      <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
  60  
  61          <h2><?php _e('Activation Key Required') ?></h2>
  62          <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
  63              <p>
  64                  <label for="key"><?php _e('Activation Key:') ?></label>
  65                  <br /><input type="text" name="key" id="key" value="" size="50" />
  66              </p>
  67              <p class="submit">
  68                  <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
  69              </p>
  70          </form>
  71  
  72      <?php } else {
  73  
  74          $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
  75          $result = wpmu_activate_signup($key);
  76          if ( is_wp_error($result) ) {
  77              if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
  78                  $signup = $result->get_error_data();
  79                  ?>
  80                  <h2><?php _e('Your account is now active!'); ?></h2>
  81                  <?php
  82                  echo '<p class="lead-in">';
  83                  if ( $signup->domain . $signup->path == '' ) {
  84                      printf( __('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. 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() );
  85                  } else {
  86                      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 &#8220;%3$s&#8221;. 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() );
  87                  }
  88                  echo '</p>';
  89              } else {
  90                  ?>
  91                  <h2><?php _e('An error occurred during the activation'); ?></h2>
  92                  <?php
  93                  echo '<p>'.$result->get_error_message().'</p>';
  94              }
  95          } else {
  96              extract($result);
  97              $url = get_blogaddress_by_id( (int) $blog_id);
  98              $user = get_userdata( (int) $user_id);
  99              ?>
 100              <h2><?php _e('Your account is now active!'); ?></h2>
 101  
 102              <div id="signup-welcome">
 103                  <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
 104                  <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
 105              </div>
 106  
 107              <?php if ( $url != network_home_url('', 'http') ) : ?>
 108                  <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>
 109              <?php else: ?>
 110                  <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>
 111              <?php endif;
 112          }
 113      }
 114      ?>
 115  </div>
 116  <script type="text/javascript">
 117      var key_input = document.getElementById('key');
 118      key_input && key_input.focus();
 119  </script>
 120  <?php get_footer(); ?>


Développement Wordpress responsive design Montréal
Generated: Thu Feb 21 16:28:30 2013 Cross-referenced by PHPXref 0.7.1