Changeset 438200
- Timestamp:
- 09/14/2011 06:42:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
alternate-contact-info/branches/AdamBackstrom/altcontact.php
r266322 r438200 29 29 30 30 return $user; 31 } else{32 return false; 33 }31 } 32 33 return false; 34 34 } 35 35 … … 128 128 } 129 129 130 function ac_user_profile_save( ) {130 function ac_user_profile_save( $user_id ) { 131 131 global $errors, $wpdb, $wptix, $current_user, $current_site; 132 132 $errors = new WP_Error(); 133 133 134 if( $user_id == $current_user->ID ) { 135 $user = $current_user; 136 } else { 137 $user = get_userdata( $user_id ); 138 } 139 134 140 // is there a wptix confirmation code in the mix? 135 141 if( isset( $_POST['phone_confirmation'] ) && ( !empty( $_POST['phone_confirmation'] ))){ 136 if( ( $ticket = $wptix->is_ticket( $_POST['phone_confirmation'] )) && $ticket->arg['user_id'] == $ current_user->ID ){142 if( ( $ticket = $wptix->is_ticket( $_POST['phone_confirmation'] )) && $ticket->arg['user_id'] == $user->ID ){ 137 143 $wptix->do_ticket( $_POST['phone_confirmation'] ); 138 144 }else{ … … 143 149 144 150 // is the primary email address changing? 145 if( isset( $_POST['email'] ) && ( $ current_user->user_email != sanitize_email( $_POST['email'] ))) {151 if( isset( $_POST['email'] ) && ( $user->user_email != sanitize_email( $_POST['email'] ))) { 146 152 147 153 $_POST['email'] = sanitize_email( $_POST['email'] ); … … 160 166 161 167 // delete any previous addys waiting to be confirmed 162 if( $waiting = get_usermeta( $ current_user->ID, 'email_waiting' ))163 ac_delete_waiting( $ current_user->ID, 'email', $waiting['ticket'] );168 if( $waiting = get_usermeta( $user->ID, 'email_waiting' )) 169 ac_delete_waiting( $user->ID, 'email', $waiting['ticket'] ); 164 170 165 171 // notify user to confirm new addy 166 ac_notify_email( $ current_user, $_POST['email'], 'email' );172 ac_notify_email( $user, $_POST['email'], 'email' ); 167 173 168 174 // reset the email address to the current 169 $_POST['email'] = $ current_user->user_email;175 $_POST['email'] = $user->user_email; 170 176 } 171 177 172 178 // is the alternate email address changing? 173 if( isset( $_POST['email_alt'] ) && ( $ current_user->email_alt != sanitize_email( $_POST['email_alt'] ))) {179 if( isset( $_POST['email_alt'] ) && ( $user->email_alt != sanitize_email( $_POST['email_alt'] ))) { 174 180 175 181 $_POST['email_alt'] = sanitize_email( $_POST['email_alt'] ); … … 188 194 189 195 // delete any previous addys waiting to be confirmed 190 if( $waiting = get_usermeta( $ current_user->ID, 'email_alt_waiting' ))191 ac_delete_waiting( $ current_user->ID, 'email_alt', $waiting['ticket'] );196 if( $waiting = get_usermeta( $user->ID, 'email_alt_waiting' )) 197 ac_delete_waiting( $user->ID, 'email_alt', $waiting['ticket'] ); 192 198 193 199 // notify user to confirm new addy 194 ac_notify_email( $ current_user, $_POST['email_alt'], 'email_alt' );200 ac_notify_email( $user, $_POST['email_alt'], 'email_alt' ); 195 201 } 196 202 197 203 // is the phone number changing? 198 if( isset( $_POST['phone'] ) && ( $ current_user->phone != sanitize_phone( $_POST['phone'] ))) {204 if( isset( $_POST['phone'] ) && ( $user->phone != sanitize_phone( $_POST['phone'] ))) { 199 205 200 206 $_POST['phone'] = sanitize_phone( $_POST['phone'] ); … … 213 219 214 220 // delete any previous phones waiting to be confirmed 215 if( $waiting = get_usermeta( $ current_user->ID, 'phone_waiting' ))216 ac_delete_waiting( $ current_user->ID, 'phone', $waiting['ticket'] );221 if( $waiting = get_usermeta( $user->ID, 'phone_waiting' )) 222 ac_delete_waiting( $user->ID, 'phone', $waiting['ticket'] ); 217 223 218 224 // notify user to confirm new addy 219 if( ! ac_notify_phone( $ current_user, $_POST['phone'], 'phone' )){225 if( ! ac_notify_phone( $user, $_POST['phone'], 'phone' )){ 220 226 $errors->add( 'user_phone', __( "<strong>ERROR</strong>: The confirmation message could not be sent. The entered phone number may not be a valid cell phone, please check and try again." ), array( 'form-field' => 'phone' ) ); 221 227 return; … … 372 378 373 379 function ac_init(){ 374 add_action( 'personal_options_update', 'ac_user_profile_save' );375 add_action( 'edit_user_profile_update', 'ac_user_profile_save' );380 add_action( 'personal_options_update', 'ac_user_profile_save', 10, 1 ); 381 add_action( 'edit_user_profile_update', 'ac_user_profile_save', 10, 1 ); 376 382 377 383 if( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) || strpos( $_SERVER['PHP_SELF'], 'user-edit.php' )) {
Note: See TracChangeset
for help on using the changeset viewer.