| 71 | /** |
| 72 | * Prints the error output for a failed activation request. |
| 73 | * |
| 74 | * @since 4.6.0 |
| 75 | * |
| 76 | * @param WP_Error $result The error result of the activation request. |
| 77 | */ |
| 78 | function signup_activation_error( $result ) { |
| 79 | /** |
| 80 | * Filters the output printed for a failed activation request. |
| 81 | * |
| 82 | * Returning a non-empty value will effectively short-circuit the generation process for the output. |
| 83 | * |
| 84 | * @since 4.6.0 |
| 85 | * |
| 86 | * @param string $output An empty string to be modified. |
| 87 | * @param WP_Error $result The error result of the activation request. |
| 88 | */ |
| 89 | $output = apply_filters( 'pre_signup_activation_error', '', $result ); |
| 90 | if ( ! empty( $output ) ) { |
| 91 | echo $output; |
| 92 | return; |
| 93 | } |
| 94 | |
| 95 | if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) { |
| 96 | $signup = $result->get_error_data(); |
| 97 | ?> |
| 98 | <h2><?php _e('Your account is now active!'); ?></h2> |
| 99 | <?php |
| 100 | echo '<p class="lead-in">'; |
| 101 | if ( $signup->domain . $signup->path == '' ) { |
| 102 | printf( |
| 103 | /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */ |
| 104 | __( '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>.' ), |
| 105 | network_site_url( 'wp-login.php', 'login' ), |
| 106 | $signup->user_login, |
| 107 | $signup->user_email, |
| 108 | wp_lostpassword_url() |
| 109 | ); |
| 110 | } else { |
| 111 | printf( |
| 112 | /* translators: 1: site URL, 2: site domain, 3: username, 4: user email, 5: lost password URL */ |
| 113 | __( '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>.' ), |
| 114 | 'http://' . $signup->domain, |
| 115 | $signup->domain, |
| 116 | $signup->user_login, |
| 117 | $signup->user_email, |
| 118 | wp_lostpassword_url() |
| 119 | ); |
| 120 | } |
| 121 | echo '</p>'; |
| 122 | } else { |
| 123 | ?> |
| 124 | <h2><?php _e( 'An error occurred during the activation' ); ?></h2> |
| 125 | <p><?php echo $result->get_error_message(); ?></p> |
| 126 | <?php |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Prints the output for a successful activation request. |
| 132 | * |
| 133 | * @since 4.6.0 |
| 134 | * |
| 135 | * @param array $result The result data of the activation request. |
| 136 | */ |
| 137 | function signup_activation_success( $result ) { |
| 138 | /** |
| 139 | * Filters the output printed for a successful activation request. |
| 140 | * |
| 141 | * Returning a non-empty value will effectively short-circuit the generation process for the output. |
| 142 | * |
| 143 | * @since 4.6.0 |
| 144 | * |
| 145 | * @param string $output An empty string to be modified. |
| 146 | * @param array $result The result data of the activation request. |
| 147 | */ |
| 148 | $output = apply_filters( 'pre_signup_activation_success', '', $result ); |
| 149 | if ( ! empty( $output ) ) { |
| 150 | echo $output; |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | $url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : ''; |
| 155 | $user = get_userdata( (int) $result['user_id'] ); |
| 156 | ?> |
| 157 | <h2><?php _e('Your account is now active!'); ?></h2> |
| 158 | |
| 159 | <div id="signup-welcome"> |
| 160 | <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p> |
| 161 | <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p> |
| 162 | </div> |
| 163 | |
| 164 | <?php if ( $url && $url != network_home_url( '', 'http' ) ) : |
| 165 | switch_to_blog( (int) $result['blog_id'] ); |
| 166 | $login_url = wp_login_url(); |
| 167 | restore_current_blog(); |
| 168 | ?> |
| 169 | <p class="view"><?php |
| 170 | /* translators: 1: site URL, 2: login URL */ |
| 171 | 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 ) ); |
| 172 | ?></p> |
| 173 | <?php else: ?> |
| 174 | <p class="view"><?php |
| 175 | /* translators: 1: login URL, 2: network home URL */ |
| 176 | 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() ); |
| 177 | ?></p> |
| 178 | <?php endif; |
| 179 | } |
| 180 | |
94 | | if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) { |
95 | | $signup = $result->get_error_data(); |
96 | | ?> |
97 | | <h2><?php _e('Your account is now active!'); ?></h2> |
98 | | <?php |
99 | | echo '<p class="lead-in">'; |
100 | | if ( $signup->domain . $signup->path == '' ) { |
101 | | printf( |
102 | | /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */ |
103 | | __( '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>.' ), |
104 | | network_site_url( 'wp-login.php', 'login' ), |
105 | | $signup->user_login, |
106 | | $signup->user_email, |
107 | | wp_lostpassword_url() |
108 | | ); |
109 | | } else { |
110 | | printf( |
111 | | /* translators: 1: site URL, 2: site domain, 3: username, 4: user email, 5: lost password URL */ |
112 | | __( '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>.' ), |
113 | | 'http://' . $signup->domain, |
114 | | $signup->domain, |
115 | | $signup->user_login, |
116 | | $signup->user_email, |
117 | | wp_lostpassword_url() |
118 | | ); |
119 | | } |
120 | | echo '</p>'; |
121 | | } else { |
122 | | ?> |
123 | | <h2><?php _e( 'An error occurred during the activation' ); ?></h2> |
124 | | <p><?php echo $result->get_error_message(); ?></p> |
125 | | <?php |
126 | | } |
| 204 | signup_activation_error( $result ); |
128 | | $url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : ''; |
129 | | $user = get_userdata( (int) $result['user_id'] ); |
130 | | ?> |
131 | | <h2><?php _e('Your account is now active!'); ?></h2> |
132 | | |
133 | | <div id="signup-welcome"> |
134 | | <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p> |
135 | | <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p> |
136 | | </div> |
137 | | |
138 | | <?php if ( $url && $url != network_home_url( '', 'http' ) ) : |
139 | | switch_to_blog( (int) $result['blog_id'] ); |
140 | | $login_url = wp_login_url(); |
141 | | restore_current_blog(); |
142 | | ?> |
143 | | <p class="view"><?php |
144 | | /* translators: 1: site URL, 2: login URL */ |
145 | | 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 ) ); |
146 | | ?></p> |
147 | | <?php else: ?> |
148 | | <p class="view"><?php |
149 | | /* translators: 1: login URL, 2: network home URL */ |
150 | | 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() ); |
151 | | ?></p> |
152 | | <?php endif; |
| 206 | signup_activation_success( $result ); |