Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: registration_errors

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2377       * If any errors are present in $errors, this will abort the user's registration.
2378       *
2379       * @since 2.1.0
2380       *
2381       * @param WP_Error $errors               A WP_Error object containing any errors encountered
2382       *                                       during registration.
2383       * @param string   $sanitized_user_login User's username after it has been sanitized.
2384       * @param string   $user_email           User's email.
2385       */
2386      $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
2387
2388      if ( $errors->get_error_code() )
2389           return $errors;
2390
2391      $user_pass = wp_generate_password( 12, false );
2392      $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
2393      if ( ! $user_id || is_wp_error( $user_id ) ) {
2394           $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
2395           return $errors;