a4edb6c3 by Jeff Balicki

qa

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 60406870
...@@ -222,8 +222,6 @@ function format_phone_string( $phoneNumber ) { ...@@ -222,8 +222,6 @@ function format_phone_string( $phoneNumber ) {
222 222
223 add_filter( 'um_profile_field_filter_hook__department_email', 'um_get_department_email', 99, 2); 223 add_filter( 'um_profile_field_filter_hook__department_email', 'um_get_department_email', 99, 2);
224 224
225
226
227 function um_get_department_email( $data ) { 225 function um_get_department_email( $data ) {
228 $arr = explode(">", $data); 226 $arr = explode(">", $data);
229 $arr = explode("<", $arr[1]); 227 $arr = explode("<", $arr[1]);
...@@ -231,20 +229,32 @@ function um_get_department_email( $data ) { ...@@ -231,20 +229,32 @@ function um_get_department_email( $data ) {
231 return $data; 229 return $data;
232 } 230 }
233 231
232 add_filter( 'um_profile_field_filter_hook__department_branch', 'um_get_department_department_branch', 99, 2);
233
234 function um_get_department_department_branch( $data ) {
235 $profile_id = um_profile_id();
236 if($profile_id != get_current_user_id()){
237 $department_email = get_user_meta( $profile_id , 'department_email', true);
238 if($department_email !=" "){
239 $data = '<a href="mailto:'.$department_email.'">'.$data.'</a>';
240 }
241 }
242 return $data;
243 }
244
245
234 246
235 add_action( 'init', 'wpa_34245' ); 247 add_action( 'init', 'wpa_34245' );
236 248
237 function wpa_34245() { 249 function wpa_34245() {
238 // if query var is not present just return 250 // if query var is not present just return
239 if ( isset( $_REQUEST['my_listener'] ) || 'update_office_email' == $_REQUEST['my_listener'] ){ 251 if ( isset( $_REQUEST['my_listener'] ) || 'update_office' == $_REQUEST['my_listener'] ){
240 $users = get_users( array( 'fields' => array( 'ID' ) ) );
241 foreach($users as $user){
242 update_office_email($user->ID);
243 }
244 }else if ( isset( $_REQUEST['my_listener'] ) || 'update_fax' == $_REQUEST['my_listener'] ){
245 $users = get_users( array( 'fields' => array( 'ID' ) ) ); 252 $users = get_users( array( 'fields' => array( 'ID' ) ) );
246 foreach($users as $user){ 253 foreach($users as $user){
247 update_branch_fax($user->ID); 254 //wp_update_user($user->ID);
255 do_action( 'profile_update', $user->ID, '', '');
256
257
248 } 258 }
249 }else{ 259 }else{
250 return; 260 return;
...@@ -256,6 +266,7 @@ function wpa_34245() { ...@@ -256,6 +266,7 @@ function wpa_34245() {
256 add_action( 'profile_update', function ( $user_id, $old_user_data ) { 266 add_action( 'profile_update', function ( $user_id, $old_user_data ) {
257 update_office_email($user_id); 267 update_office_email($user_id);
258 update_branch_fax($user_id); 268 update_branch_fax($user_id);
269 error_log('profile update '.$user_id);
259 }, 10, 2 ); 270 }, 10, 2 );
260 271
261 272
...@@ -264,13 +275,14 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) { ...@@ -264,13 +275,14 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) {
264 $department_branch = get_user_meta($userID, 'department_branch', true ); 275 $department_branch = get_user_meta($userID, 'department_branch', true );
265 $department_fax = find_branch_info($department_branch, 'fax'); 276 $department_fax = find_branch_info($department_branch, 'fax');
266 update_user_meta( $userID, 'phone_number_12', $department_fax); 277 update_user_meta( $userID, 'phone_number_12', $department_fax);
278
267 } 279 }
268 280
269 281
270 function update_office_email($userID) { 282 function update_office_email($userID) {
271 $department_branch = get_user_meta( $userID, 'department_branch', true ); 283 $department_branch = get_user_meta( $userID, 'department_branch', true );
272 $department_email = find_branch_info($department_branch, 'email'); 284 $department_email = find_branch_info($department_branch, 'email');
273 update_user_meta( $userID, 'department_email',$department_email ); 285 update_user_meta( $userID, 'department_email', $department_email );
274 286
275 } 287 }
276 288
......