60 if ( !is_email( $email ) ) |
60 if ( !is_email( $email ) ) |
61 wp_die( __( 'Invalid email address.' ) ); |
61 wp_die( __( 'Invalid email address.' ) ); |
62 |
62 |
63 if ( is_subdomain_install() ) { |
63 if ( is_subdomain_install() ) { |
64 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); |
64 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); |
65 $path = $base; |
65 $path = $current_site->path; |
66 } else { |
66 } else { |
67 $newdomain = $current_site->domain; |
67 $newdomain = $current_site->domain; |
68 $path = $base . $domain . '/'; |
68 $path = $current_site->path . $domain . '/'; |
69 } |
69 } |
70 |
70 |
71 $password = 'N/A'; |
71 $password = 'N/A'; |
72 $user_id = email_exists($email); |
72 $user_id = email_exists($email); |
73 if ( !$user_id ) { // Create a new user with a random password |
73 if ( !$user_id ) { // Create a new user with a random password |
83 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id ); |
83 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id ); |
84 $wpdb->show_errors(); |
84 $wpdb->show_errors(); |
85 if ( !is_wp_error( $id ) ) { |
85 if ( !is_wp_error( $id ) ) { |
86 if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) |
86 if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) |
87 update_user_option( $user_id, 'primary_blog', $id, true ); |
87 update_user_option( $user_id, 'primary_blog', $id, true ); |
88 $content_mail = sprintf( __( "New site created by %1s\n\nAddress: %2s\nName: %3s"), $current_user->user_login , get_site_url( $id ), stripslashes( $title ) ); |
88 $content_mail = sprintf( __( 'New site created by %1$s |
|
89 |
|
90 Address: %2$s |
|
91 Name: %3$s' ), $current_user->user_login , get_site_url( $id ), stripslashes( $title ) ); |
89 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); |
92 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); |
90 wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); |
93 wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); |
91 wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); |
94 wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); |
92 exit; |
95 exit; |
93 } else { |
96 } else { |
125 <?php if ( is_subdomain_install() ) { ?> |
128 <?php if ( is_subdomain_install() ) { ?> |
126 <input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span> |
129 <input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span> |
127 <?php } else { |
130 <?php } else { |
128 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/> |
131 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/> |
129 <?php } |
132 <?php } |
130 echo '<p>' . __( 'Only the characters a-z and 0-9 recommended.' ) . '</p>'; |
133 echo '<p>' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>'; |
131 ?> |
134 ?> |
132 </td> |
135 </td> |
133 </tr> |
136 </tr> |
134 <tr class="form-field form-required"> |
137 <tr class="form-field form-required"> |
135 <th scope="row"><?php _e( 'Site Title' ) ?></th> |
138 <th scope="row"><?php _e( 'Site Title' ) ?></th> |