Skip to:
Content

bbPress.org

Changeset 1833


Ignore:
Timestamp:
12/08/2008 11:49:44 PM (18 years ago)
Author:
sambauers
Message:

Fix broken email address editing in profile - Fixes #1004 for branches/0.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9/profile-edit.php

    r1622 r1833  
    2727        $assignable_caps = get_assignable_caps();
    2828}
    29 $updated = false;
    30 $user_email = true;
    3129
    3230$errors = new WP_Error;
    … …  
    4947        }
    5048
     49        // Find out if we have a valid email address
     50        if ( !$user_email = bb_verify_email( $user_email ) ) {
     51                $errors->add( 'user_email', __( 'Invalid email address' ), array( 'data' => $_POST['user_email'] ) );
     52        }
     53
    5154        if ( bb_current_user_can('edit_users') ) {
    5255                if ( isset($_POST['delete-user']) && $_POST['delete-user'] && $bb_current_id != $user->ID ) {
    … …  
    5558                        exit;
    5659                }
    57 
    58                 if ( isset($_POST['user_email']) )
    59                         if ( !$user_email = bb_verify_email( $_POST['user_email'] ) )
    60                                 $errors->add( 'user_email', __( 'Invalid email address' ), array( 'data' => $_POST['user_email'] ) );
    6160
    6261                $user_obj = new BB_User( $user->ID );
    … …  
    9695        }
    9796
    98         $updated = true;
     97        if ( !$errors->get_error_codes() ) {
     98                if ( bb_current_user_can( 'edit_user', $user->ID ) ) {
     99                        bb_update_user( $user->ID, $user_email, $user_url );
    99100
    100         if ( $user_email && !$errors->get_error_codes() ) {
    101                 if ( bb_current_user_can( 'edit_user', $user->ID ) ) {
    102                         if ( is_string($user_email) ) {
    103                                 bb_update_user( $user->ID, $user_email, $user_url );
    104                         } else {
    105                                 bb_update_user( $user->ID, $user->user_email, $user_url );
    106                         }
    107101                        foreach( $profile_info_keys as $key => $label )
    108102                                if ( strpos($key, 'user_') !== 0 )
    … …  
    138132
    139133                wp_redirect( add_query_arg( 'updated', 'true', get_user_profile_link( $user->ID ) ) );
    140                 exit;
     134                exit;   
    141135        }
    142136}
    143137
    144 bb_load_template( 'profile-edit.php', array('profile_info_keys', 'profile_admin_keys', 'assignable_caps', 'updated', 'user_email', 'bb_roles', 'errors') );
     138bb_load_template( 'profile-edit.php', array('profile_info_keys', 'profile_admin_keys', 'assignable_caps', 'user_email', 'bb_roles', 'errors') );
    145139
    146140?>
Note: See TracChangeset for help on using the changeset viewer.