Intranet Directory Change
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
2 changed files
with
58 additions
and
1 deletions
| ... | @@ -167,3 +167,54 @@ function is_valid_email_domain($login, $email, $errors ){ | ... | @@ -167,3 +167,54 @@ function is_valid_email_domain($login, $email, $errors ){ |
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| 169 | add_action('register_post', 'is_valid_email_domain',10,3 ); | 169 | add_action('register_post', 'is_valid_email_domain',10,3 ); |
| 170 | |||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | add_filter( 'um_profile_field_filter_hook__phone_number_12', 'my_profile_phone_number', 10, 2 ); | ||
| 175 | add_filter( 'um_profile_field_filter_hook__phone_number', 'my_profile_phone_number', 10, 2 ); | ||
| 176 | function my_profile_phone_number( $value, $data ) { | ||
| 177 | $value = format_phone_string( $value ); | ||
| 178 | return $value; | ||
| 179 | } | ||
| 180 | |||
| 181 | add_filter( 'um_view_label_phone_number', 'my_phone_number_label', 10, 1 ); | ||
| 182 | function my_phone_number_label( $label ) { | ||
| 183 | |||
| 184 | $label = "Direct Line / Branch"; | ||
| 185 | return $label; | ||
| 186 | } | ||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | function format_phone_string( $phoneNumber ) { | ||
| 191 | |||
| 192 | // Return the phone number in parentheses format, e.g. (123) 456-7890. | ||
| 193 | // Handles 10 digit numbers with or without country codes and extensions | ||
| 194 | // Source 2nd part from: https://stackoverflow.com/questions/4708248/formatting-phone-numbers-in-php | ||
| 195 | $phoneNumber = preg_replace('/[^0-9]/','',$phoneNumber); | ||
| 196 | |||
| 197 | if(strlen($phoneNumber) > 10) { | ||
| 198 | $countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10); | ||
| 199 | $areaCode = substr($phoneNumber, -10, 3); | ||
| 200 | $nextThree = substr($phoneNumber, -7, 3); | ||
| 201 | $lastFour = substr($phoneNumber, -4, 4); | ||
| 202 | |||
| 203 | $phoneNumber = '+'.$countryCode.' ('.$areaCode.') '.$nextThree.'-'.$lastFour; | ||
| 204 | } | ||
| 205 | else if(strlen($phoneNumber) == 10) { | ||
| 206 | $areaCode = substr($phoneNumber, 0, 3); | ||
| 207 | $nextThree = substr($phoneNumber, 3, 3); | ||
| 208 | $lastFour = substr($phoneNumber, 6, 4); | ||
| 209 | |||
| 210 | $phoneNumber = '('.$areaCode.') '.$nextThree.'-'.$lastFour; | ||
| 211 | } | ||
| 212 | else if(strlen($phoneNumber) == 7) { | ||
| 213 | $nextThree = substr($phoneNumber, 0, 3); | ||
| 214 | $lastFour = substr($phoneNumber, 3, 4); | ||
| 215 | |||
| 216 | $phoneNumber = $nextThree.'-'.$lastFour; | ||
| 217 | } | ||
| 218 | |||
| 219 | return $phoneNumber; | ||
| 220 | } | ... | ... |
| ... | @@ -86,7 +86,13 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?> | ... | @@ -86,7 +86,13 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?> |
| 86 | 86 | ||
| 87 | <# if ( typeof user['<?php echo $key; ?>'] !== 'undefined' ) { #> | 87 | <# if ( typeof user['<?php echo $key; ?>'] !== 'undefined' ) { #> |
| 88 | <div class="um-member-metaline um-member-metaline-<?php echo $key; ?>"> | 88 | <div class="um-member-metaline um-member-metaline-<?php echo $key; ?>"> |
| 89 | <strong>{{{user['label_<?php echo $key;?>']}}}:</strong> {{{user['<?php echo $key;?>']}}} | 89 | <?php if ( $key !== 'phone_number') { ?> |
| 90 | <strong>{{{user['label_<?php echo $key;?>']}}}:</strong> | ||
| 91 | <?php } ?> | ||
| 92 | <?php if ( $key === 'phone_number') { ?> | ||
| 93 | <strong>Direct Line / Branch:</strong> | ||
| 94 | <?php } ?> | ||
| 95 | {{{user['<?php echo $key;?>']}}} | ||
| 90 | </div> | 96 | </div> |
| 91 | <# } #> | 97 | <# } #> |
| 92 | 98 | ... | ... |
-
Please register or sign in to post a comment