PageRenderTime 32ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-signup.php

https://gitlab.com/Gashler/dp
PHP | 584 lines | 361 code | 70 blank | 153 comment | 79 complexity | 2306a6228bd35f8766fae988c505efc2 MD5 | raw file
  1. <?php
  2. /** Sets up the WordPress Environment. */
  3. require( dirname(__FILE__) . '/wp-load.php' );
  4. add_action( 'wp_head', 'wp_no_robots' );
  5. require( './wp-blog-header.php' );
  6. if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
  7. wp_redirect( network_home_url() );
  8. die();
  9. }
  10. /**
  11. * Prints signup_header via wp_head
  12. *
  13. * @since MU
  14. */
  15. function do_signup_header() {
  16. do_action( 'signup_header' );
  17. }
  18. add_action( 'wp_head', 'do_signup_header' );
  19. if ( !is_multisite() ) {
  20. wp_redirect( site_url('wp-login.php?action=register') );
  21. die();
  22. }
  23. if ( !is_main_site() ) {
  24. wp_redirect( network_site_url( 'wp-signup.php' ) );
  25. die();
  26. }
  27. // Fix for page title
  28. $wp_query->is_404 = false;
  29. /**
  30. * Prints styles for front-end Multisite signup pages
  31. *
  32. * @since MU
  33. */
  34. function wpmu_signup_stylesheet() {
  35. ?>
  36. <style type="text/css">
  37. .mu_register { width: 90%; margin:0 auto; }
  38. .mu_register form { margin-top: 2em; }
  39. .mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; }
  40. .mu_register input[type="submit"],
  41. .mu_register #blog_title,
  42. .mu_register #user_email,
  43. .mu_register #blogname,
  44. .mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
  45. .mu_register .prefix_address,
  46. .mu_register .suffix_address {font-size: 18px;display:inline; }
  47. .mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
  48. .mu_register label.checkbox { display:inline; }
  49. .mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
  50. </style>
  51. <?php
  52. }
  53. add_action( 'wp_head', 'wpmu_signup_stylesheet' );
  54. get_header();
  55. do_action( 'before_signup_form' );
  56. ?>
  57. <div id="content" class="widecolumn">
  58. <div class="mu_register">
  59. <?php
  60. /**
  61. * Generates and displays the Signup and Create Site forms
  62. *
  63. * @since MU
  64. *
  65. * @param string $blogname The new site name
  66. * @param string $blog_title The new site title
  67. * @param array $errors
  68. */
  69. function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
  70. global $current_site;
  71. // Blog name
  72. if ( !is_subdomain_install() )
  73. echo '<label for="blogname">' . __('Site Name:') . '</label>';
  74. else
  75. echo '<label for="blogname">' . __('Site Domain:') . '</label>';
  76. if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
  77. <p class="error"><?php echo $errmsg ?></p>
  78. <?php }
  79. if ( !is_subdomain_install() )
  80. echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
  81. else
  82. echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';
  83. if ( !is_user_logged_in() ) {
  84. if ( !is_subdomain_install() )
  85. $site = $current_site->domain . $current_site->path . __( 'sitename' );
  86. else
  87. $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
  88. echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
  89. }
  90. // Blog Title
  91. ?>
  92. <label for="blog_title"><?php _e('Site Title:') ?></label>
  93. <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
  94. <p class="error"><?php echo $errmsg ?></p>
  95. <?php }
  96. echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
  97. ?>
  98. <div id="privacy">
  99. <p class="privacy-intro">
  100. <label for="blog_public_on"><?php _e('Privacy:') ?></label>
  101. <?php _e( 'Allow search engines to index this site.' ); ?>
  102. <br style="clear:both" />
  103. <label class="checkbox" for="blog_public_on">
  104. <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
  105. <strong><?php _e( 'Yes' ); ?></strong>
  106. </label>
  107. <label class="checkbox" for="blog_public_off">
  108. <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
  109. <strong><?php _e( 'No' ); ?></strong>
  110. </label>
  111. </p>
  112. </div>
  113. <?php
  114. do_action('signup_blogform', $errors);
  115. }
  116. /**
  117. * Validate the new site signup
  118. *
  119. * @since MU
  120. *
  121. * @uses wp_get_current_user() to retrieve the current user
  122. * @uses wpmu_validate_blog_signup() to validate new site signup for the current user
  123. * @return array Contains the new site data and error messages.
  124. */
  125. function validate_blog_form() {
  126. $user = '';
  127. if ( is_user_logged_in() )
  128. $user = wp_get_current_user();
  129. return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
  130. }
  131. /**
  132. * Display user registration form
  133. *
  134. * @since MU
  135. *
  136. * @param string $user_name The entered username
  137. * @param string $user_email The entered email address
  138. * @param array $errors
  139. */
  140. function show_user_form($user_name = '', $user_email = '', $errors = '') {
  141. // User name
  142. echo '<label for="user_name">' . __('Username:') . '</label>';
  143. if ( $errmsg = $errors->get_error_message('user_name') ) {
  144. echo '<p class="error">'.$errmsg.'</p>';
  145. }
  146. echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
  147. _e( '(Must be at least 4 characters, letters and numbers only.)' );
  148. ?>
  149. <label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
  150. <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
  151. <p class="error"><?php echo $errmsg ?></p>
  152. <?php } ?>
  153. <input name="user_email" type="text" id="user_email" value="<?php echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?>
  154. <?php
  155. if ( $errmsg = $errors->get_error_message('generic') ) {
  156. echo '<p class="error">' . $errmsg . '</p>';
  157. }
  158. do_action( 'signup_extra_fields', $errors );
  159. }
  160. /**
  161. * Validate user signup name and email
  162. *
  163. * @since MU
  164. *
  165. * @uses wpmu_validate_user_signup() to retrieve an array of user data
  166. * @return array Contains username, email, and error messages.
  167. */
  168. function validate_user_form() {
  169. return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
  170. }
  171. /**
  172. * Allow returning users to sign up for another site
  173. *
  174. * @since MU
  175. *
  176. * @uses wp_get_current_user() to get the current user
  177. * @param string $blogname The new site name
  178. * @param string $blog_title The new blog title
  179. * @param array $errors
  180. */
  181. function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
  182. global $current_site;
  183. $current_user = wp_get_current_user();
  184. if ( ! is_wp_error($errors) ) {
  185. $errors = new WP_Error();
  186. }
  187. // allow definition of default variables
  188. $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
  189. $blogname = $filtered_results['blogname'];
  190. $blog_title = $filtered_results['blog_title'];
  191. $errors = $filtered_results['errors'];
  192. echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>';
  193. if ( $errors->get_error_code() ) {
  194. echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
  195. }
  196. ?>
  197. <p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name ) ?></p>
  198. <?php
  199. $blogs = get_blogs_of_user($current_user->ID);
  200. if ( !empty($blogs) ) { ?>
  201. <p><?php _e( 'Sites you are already a member of:' ) ?></p>
  202. <ul>
  203. <?php foreach ( $blogs as $blog ) {
  204. $home_url = get_home_url( $blog->userblog_id );
  205. echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
  206. } ?>
  207. </ul>
  208. <?php } ?>
  209. <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
  210. <form id="setupform" method="post" action="wp-signup.php">
  211. <input type="hidden" name="stage" value="gimmeanotherblog" />
  212. <?php do_action( 'signup_hidden_fields' ); ?>
  213. <?php show_blog_form($blogname, $blog_title, $errors); ?>
  214. <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
  215. </form>
  216. <?php
  217. }
  218. /**
  219. * Validate a new blog signup
  220. *
  221. * @since MU
  222. *
  223. * @uses wp_get_current_user() to retrieve the current user
  224. * @uses wpmu_create_blog() to add a new site
  225. * @uses confirm_another_blog_signup() to confirm the user's new site signup
  226. * @return bool True if blog signup was validated, false if error
  227. */
  228. function validate_another_blog_signup() {
  229. global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
  230. $current_user = wp_get_current_user();
  231. if ( !is_user_logged_in() )
  232. die();
  233. $result = validate_blog_form();
  234. extract($result);
  235. if ( $errors->get_error_code() ) {
  236. signup_another_blog($blogname, $blog_title, $errors);
  237. return false;
  238. }
  239. $public = (int) $_POST['blog_public'];
  240. $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated
  241. $meta = apply_filters( 'add_signup_meta', $meta );
  242. wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
  243. confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
  244. return true;
  245. }
  246. /**
  247. * Confirm a new site signup
  248. *
  249. * @since MU
  250. *
  251. * @param string $domain The domain URL
  252. * @param string $path The site root path
  253. * @param string $user_name The username
  254. * @param string $user_email The user's email address
  255. * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
  256. */
  257. function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) {
  258. ?>
  259. <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
  260. <p>
  261. <?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.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?>
  262. </p>
  263. <?php
  264. do_action( 'signup_finished' );
  265. }
  266. /**
  267. * Setup the new user signup process
  268. *
  269. * @since MU
  270. *
  271. * @uses apply_filters() filter $filtered_results
  272. * @uses show_user_form() to display the user registration form
  273. * @param string $user_name The username
  274. * @param string $user_email The user's email
  275. * @param array $errors
  276. */
  277. function signup_user($user_name = '', $user_email = '', $errors = '') {
  278. global $current_site, $active_signup;
  279. if ( !is_wp_error($errors) )
  280. $errors = new WP_Error();
  281. $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
  282. // allow definition of default variables
  283. $filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors ));
  284. $user_name = $filtered_results['user_name'];
  285. $user_email = $filtered_results['user_email'];
  286. $errors = $filtered_results['errors'];
  287. ?>
  288. <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>
  289. <form id="setupform" method="post" action="wp-signup.php">
  290. <input type="hidden" name="stage" value="validate-user-signup" />
  291. <?php do_action( 'signup_hidden_fields' ); ?>
  292. <?php show_user_form($user_name, $user_email, $errors); ?>
  293. <p>
  294. <?php if ( $active_signup == 'blog' ) { ?>
  295. <input id="signupblog" type="hidden" name="signup_for" value="blog" />
  296. <?php } elseif ( $active_signup == 'user' ) { ?>
  297. <input id="signupblog" type="hidden" name="signup_for" value="user" />
  298. <?php } else { ?>
  299. <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
  300. <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
  301. <br />
  302. <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
  303. <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
  304. <?php } ?>
  305. </p>
  306. <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>
  307. </form>
  308. <?php
  309. }
  310. /**
  311. * Validate the new user signup
  312. *
  313. * @since MU
  314. *
  315. * @uses validate_user_form() to retrieve an array of the user data
  316. * @uses wpmu_signup_user() to signup the new user
  317. * @uses confirm_user_signup() to confirm the new user signup
  318. * @return bool True if new user signup was validated, false if error
  319. */
  320. function validate_user_signup() {
  321. $result = validate_user_form();
  322. extract($result);
  323. if ( $errors->get_error_code() ) {
  324. signup_user($user_name, $user_email, $errors);
  325. return false;
  326. }
  327. if ( 'blog' == $_POST['signup_for'] ) {
  328. signup_blog($user_name, $user_email);
  329. return false;
  330. }
  331. wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
  332. confirm_user_signup($user_name, $user_email);
  333. return true;
  334. }
  335. /**
  336. * New user signup confirmation
  337. *
  338. * @since MU
  339. *
  340. * @param string $user_name The username
  341. * @param string $user_email The user's email address
  342. */
  343. function confirm_user_signup($user_name, $user_email) {
  344. ?>
  345. <h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2>
  346. <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
  347. <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p>
  348. <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
  349. <?php
  350. do_action( 'signup_finished' );
  351. }
  352. /**
  353. * Setup the new site signup
  354. *
  355. * @since MU
  356. *
  357. * @uses apply_filters() to filter $filtered_results
  358. * @uses show_blog_form() to display the blog signup form
  359. * @param string $user_name The username
  360. * @param string $user_email The user's email address
  361. * @param string $blogname The site name
  362. * @param string $blog_title The site title
  363. * @param array $errors
  364. */
  365. function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
  366. if ( !is_wp_error($errors) )
  367. $errors = new WP_Error();
  368. // allow definition of default variables
  369. $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
  370. $user_name = $filtered_results['user_name'];
  371. $user_email = $filtered_results['user_email'];
  372. $blogname = $filtered_results['blogname'];
  373. $blog_title = $filtered_results['blog_title'];
  374. $errors = $filtered_results['errors'];
  375. if ( empty($blogname) )
  376. $blogname = $user_name;
  377. ?>
  378. <form id="setupform" method="post" action="wp-signup.php">
  379. <input type="hidden" name="stage" value="validate-blog-signup" />
  380. <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
  381. <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
  382. <?php do_action( 'signup_hidden_fields' ); ?>
  383. <?php show_blog_form($blogname, $blog_title, $errors); ?>
  384. <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
  385. </form>
  386. <?php
  387. }
  388. /**
  389. * Validate new site signup
  390. *
  391. * @since MU
  392. *
  393. * @uses wpmu_validate_user_signup() to retrieve an array of the new user data and errors
  394. * @uses wpmu_validate_blog_signup() to retrieve an array of the new site data and errors
  395. * @uses apply_filters() to make signup $meta filterable
  396. * @uses signup_user() to signup a new user
  397. * @uses signup_blog() to signup a the new user to a new site
  398. * @return bool True if the site signup was validated, false if error
  399. */
  400. function validate_blog_signup() {
  401. // Re-validate user info.
  402. $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
  403. extract($result);
  404. if ( $errors->get_error_code() ) {
  405. signup_user($user_name, $user_email, $errors);
  406. return false;
  407. }
  408. $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
  409. extract($result);
  410. if ( $errors->get_error_code() ) {
  411. signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
  412. return false;
  413. }
  414. $public = (int) $_POST['blog_public'];
  415. $meta = array ('lang_id' => 1, 'public' => $public);
  416. $meta = apply_filters( 'add_signup_meta', $meta );
  417. wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
  418. confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
  419. return true;
  420. }
  421. /**
  422. * New site signup confirmation
  423. *
  424. * @since MU
  425. *
  426. * @param string $domain The domain URL
  427. * @param string $path The site root path
  428. * @param string $blog_title The new site title
  429. * @param string $user_name The user's username
  430. * @param string $user_email The user's email address
  431. * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
  432. */
  433. function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
  434. ?>
  435. <h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
  436. <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
  437. <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email) ?></p>
  438. <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
  439. <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
  440. <p>
  441. <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
  442. <ul id="noemail-tips">
  443. <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li>
  444. <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
  445. <li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li>
  446. </ul>
  447. </p>
  448. <?php
  449. do_action( 'signup_finished' );
  450. }
  451. // Main
  452. $active_signup = get_site_option( 'registration' );
  453. if ( !$active_signup )
  454. $active_signup = 'all';
  455. $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
  456. // Make the signup type translatable.
  457. $i18n_signup['all'] = _x('all', 'Multisite active signup type');
  458. $i18n_signup['none'] = _x('none', 'Multisite active signup type');
  459. $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
  460. $i18n_signup['user'] = _x('user', 'Multisite active signup type');
  461. if ( is_super_admin() )
  462. echo '<div class="mu_alert">' . 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( 'settings.php' ) ) ) . '</div>';
  463. $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
  464. $current_user = wp_get_current_user();
  465. if ( $active_signup == 'none' ) {
  466. _e( 'Registration has been disabled.' );
  467. } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
  468. $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) );
  469. echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
  470. } else {
  471. $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
  472. switch ( $stage ) {
  473. case 'validate-user-signup' :
  474. if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
  475. validate_user_signup();
  476. else
  477. _e( 'User registration has been disabled.' );
  478. break;
  479. case 'validate-blog-signup':
  480. if ( $active_signup == 'all' || $active_signup == 'blog' )
  481. validate_blog_signup();
  482. else
  483. _e( 'Site registration has been disabled.' );
  484. break;
  485. case 'gimmeanotherblog':
  486. validate_another_blog_signup();
  487. break;
  488. case 'default':
  489. default :
  490. $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
  491. do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere?
  492. if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
  493. signup_another_blog($newblogname);
  494. elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )
  495. signup_user( $newblogname, $user_email );
  496. elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) )
  497. _e( 'Sorry, new registrations are not allowed at this time.' );
  498. else
  499. _e( 'You are logged in already. No need to register again!' );
  500. if ( $newblogname ) {
  501. $newblog = get_blogaddress_by_name( $newblogname );
  502. if ( $active_signup == 'blog' || $active_signup == 'all' )
  503. printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist, but you can create it now!' ) . '</em></p>', $newblog );
  504. else
  505. printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist.' ) . '</em></p>', $newblog );
  506. }
  507. break;
  508. }
  509. }
  510. ?>
  511. </div>
  512. </div>
  513. <?php do_action( 'after_signup_form' ); ?>
  514. <?php get_footer(); ?>