Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: user_profile_update_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
144      if ( empty( $user->user_email ) ) {
145           $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
146      } elseif ( !is_email( $user->user_email ) ) {
147           $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) );
148      } elseif ( ( $owner_id = email_exists($user->user_email) ) && ( !$update || ( $owner_id != $user->ID ) ) ) {
149           $errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
150      }
151
152      // Allow plugins to return their own errors.
153      do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) );
154
155      if ( $errors->get_error_codes() )
156           return $errors;
157
158      if ( $update ) {
159           $user_id = wp_update_user( $user );
160      } else {
161           $user_id = wp_insert_user( $user );
162           wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? wp_unslash( $pass1 ) : '' );