department_email
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
8 changed files
with
91 additions
and
21 deletions
| ... | @@ -15868,4 +15868,9 @@ p.intro { | ... | @@ -15868,4 +15868,9 @@ p.intro { |
| 15868 | color: #aaa !important; | 15868 | color: #aaa !important; |
| 15869 | } | 15869 | } |
| 15870 | 15870 | ||
| 15871 | #um_field_467_phone_number_12, | ||
| 15872 | #department_email-453 { | ||
| 15873 | display: none !important; | ||
| 15874 | } | ||
| 15875 | |||
| 15871 | /*# sourceMappingURL=child-theme.css.map */ | 15876 | /*# sourceMappingURL=child-theme.css.map */ |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| ... | @@ -220,53 +220,102 @@ function format_phone_string( $phoneNumber ) { | ... | @@ -220,53 +220,102 @@ function format_phone_string( $phoneNumber ) { |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | 222 | ||
| 223 | function wpa_91930() { | 223 | add_filter( 'um_profile_field_filter_hook__department_email', 'um_get_department_email', 99, 2); |
| 224 | |||
| 225 | |||
| 226 | |||
| 227 | function um_get_department_email( $data ) { | ||
| 228 | $arr = explode(">", $data); | ||
| 229 | $arr = explode("<", $arr[1]); | ||
| 230 | $data = $arr[0]; | ||
| 231 | return $data; | ||
| 232 | } | ||
| 233 | |||
| 234 | |||
| 235 | add_action( 'init', 'wpa_34245' ); | ||
| 236 | |||
| 237 | function wpa_34245() { | ||
| 224 | // if query var is not present just return | 238 | // if query var is not present just return |
| 225 | if ( ! isset( $_REQUEST['my_listener'] ) || 'update_fax' != $_REQUEST['my_listener'] ){ | 239 | if ( isset( $_REQUEST['my_listener'] ) || 'update_office_email' == $_REQUEST['my_listener'] ){ |
| 226 | return; | ||
| 227 | }else{ | ||
| 228 | echo "Started<br>"; | ||
| 229 | $users = get_users( array( 'fields' => array( 'ID' ) ) ); | 240 | $users = get_users( array( 'fields' => array( 'ID' ) ) ); |
| 230 | foreach($users as $user){ | 241 | foreach($users as $user){ |
| 231 | $department_branch = get_user_meta( $user->ID, 'department_branch', true ); | 242 | error_log("Updating user: ".$user->ID); |
| 243 | updte_office_email($user->ID); | ||
| 244 | } | ||
| 245 | }else if ( isset( $_REQUEST['my_listener'] ) || 'update_fax' == $_REQUEST['my_listener'] ){ | ||
| 246 | $users = get_users( array( 'fields' => array( 'ID' ) ) ); | ||
| 247 | foreach($users as $user){ | ||
| 248 | update_branch_fax($user->ID); | ||
| 249 | } | ||
| 250 | }else{ | ||
| 251 | return; | ||
| 252 | } | ||
| 253 | |||
| 254 | |||
| 255 | } | ||
| 256 | |||
| 257 | add_action( 'profile_update', function ( $user_id, $old_user_data ) { | ||
| 258 | update_office_email($user_id); | ||
| 259 | update_branch_fax($user_id); | ||
| 260 | }, 10, 2 ); | ||
| 261 | |||
| 262 | |||
| 263 | |||
| 264 | function update_branch_fax($userID) { | ||
| 265 | // if query var is not present just return | ||
| 266 | |||
| 267 | $department_branch = get_user_meta($userID, 'department_branch', true ); | ||
| 232 | switch($department_branch){ | 268 | switch($department_branch){ |
| 233 | case "Cranbrook Branch": | 269 | case "Cranbrook Branch": |
| 234 | update_user_meta( $user->ID, 'phone_number_12', '250 426 7370' ); | 270 | update_user_meta( $userID, 'phone_number_12', '250 426 7370' ); |
| 235 | break; | 271 | break; |
| 236 | case "Commercial Department": | 272 | case "Commercial Department": |
| 237 | update_user_meta( $user->ID, 'phone_number_12', '250 426 0879' ); | 273 | update_user_meta( $userID, 'phone_number_12', '250 426 0879' ); |
| 238 | break; | 274 | break; |
| 239 | case "Elkford Branch": | 275 | case "Elkford Branch": |
| 240 | update_user_meta( $user->ID, 'phone_number_12', '250 865 7537' ); | 276 | update_user_meta( $userID, 'phone_number_12', '250 865 7537' ); |
| 241 | break; | 277 | break; |
| 242 | case "Sparwood Branch": | 278 | case "Sparwood Branch": |
| 243 | update_user_meta( $user->ID, 'phone_number_12', '250 425 0047' ); | 279 | update_user_meta( $userID, 'phone_number_12', '250 425 0047' ); |
| 244 | break; | 280 | break; |
| 245 | case "Fernie Branch": | 281 | case "Fernie Branch": |
| 246 | update_user_meta( $user->ID, 'phone_number_12', '250 423 9223' ); | 282 | update_user_meta($userID, 'phone_number_12', '250 423 9223' ); |
| 247 | break; | 283 | break; |
| 248 | case "Castlegar Branch": | 284 | case "Castlegar Branch": |
| 249 | update_user_meta( $user->ID, 'phone_number_12', '250 365 2913' ); | 285 | update_user_meta( $userID, 'phone_number_12', '250 365 2913' ); |
| 250 | break; | 286 | break; |
| 251 | case "Slocan Valley Branch": | 287 | case "Slocan Valley Branch": |
| 252 | update_user_meta( $user->ID, 'phone_number_12', '250 226 7351' ); | 288 | update_user_meta( $userID, 'phone_number_12', '250 226 7351' ); |
| 253 | break; | 289 | break; |
| 254 | case "Greenwood Branch": | 290 | case "Greenwood Branch": |
| 255 | update_user_meta( $user->ID, 'phone_number_12', '250 445 9902' ); | 291 | update_user_meta($userID, 'phone_number_12', '250 445 9902' ); |
| 256 | break; | 292 | break; |
| 257 | default: | 293 | default: |
| 258 | echo "No department_branch set.<br>"; | 294 | echo "No department_branch set.<br>"; |
| 259 | break; | 295 | break; |
| 260 | } | 296 | } |
| 261 | |||
| 262 | } | ||
| 263 | echo "Completed<br>"; | ||
| 264 | exit; | ||
| 265 | } | 297 | } |
| 266 | 298 | ||
| 267 | } | ||
| 268 | 299 | ||
| 269 | add_action( 'init', 'wpa_91930' ); | 300 | function update_office_email($userID) { |
| 301 | $department_branch = get_user_meta( $userID, 'department_branch', true ); | ||
| 302 | switch($department_branch){ | ||
| 303 | case "Administration Department": | ||
| 304 | update_user_meta( $userID, 'department_email', 'administration@stellervista.com' ); | ||
| 305 | break; | ||
| 306 | case "Accounting Department": | ||
| 307 | update_user_meta( $userID, 'department_email', 'treasuryaccount@stellervista.com' ); | ||
| 308 | break; | ||
| 309 | case "Commercial Department": | ||
| 310 | update_user_meta( $userID, 'department_email', 'commercial@stellervista.com' ); | ||
| 311 | break; | ||
| 312 | case "Member Solutions Centre": | ||
| 313 | update_user_meta( $userID, 'department_email', 'msc@stellervista.com' ); | ||
| 314 | break; | ||
| 315 | default: | ||
| 270 | 316 | ||
| 317 | break; | ||
| 318 | } | ||
| 271 | 319 | ||
| 320 | } | ||
| 272 | 321 | ... | ... |
| ... | @@ -232,3 +232,8 @@ box-shadow: 0 3px 6px rgb(0 0 0 / 16%); | ... | @@ -232,3 +232,8 @@ box-shadow: 0 3px 6px rgb(0 0 0 / 16%); |
| 232 | opacity: .4; } | 232 | opacity: .4; } |
| 233 | .um-directory .um-members-pagination-box .um-members-pagi .pagei.none { | 233 | .um-directory .um-members-pagination-box .um-members-pagi .pagei.none { |
| 234 | color: #aaa !important; } | 234 | color: #aaa !important; } |
| 235 | |||
| 236 | #um_field_467_phone_number_12, | ||
| 237 | #department_email-453{ | ||
| 238 | display: none !important; | ||
| 239 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
| 5 | Author: the Understrap Contributors | 5 | Author: the Understrap Contributors |
| 6 | Author URI: https://github.com/understrap/understrap-child/graphs/contributors | 6 | Author URI: https://github.com/understrap/understrap-child/graphs/contributors |
| 7 | Template: understrap | 7 | Template: understrap |
| 8 | Version: 1.2.0058 | 8 | Version: 1.2.0059 |
| 9 | License: GNU General Public License v2 or later | 9 | License: GNU General Public License v2 or later |
| 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html | 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 11 | Text Domain: understrap-child | 11 | Text Domain: understrap-child | ... | ... |
| ... | @@ -86,13 +86,24 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?> | ... | @@ -86,13 +86,24 @@ $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 | <?php if ( $key !== 'department_email') { ?> | ||
| 90 | |||
| 89 | <?php if ( $key !== 'phone_number') { ?> | 91 | <?php if ( $key !== 'phone_number') { ?> |
| 90 | <strong>{{{user['label_<?php echo $key;?>']}}}:</strong> | 92 | <strong>{{{user['label_<?php echo $key;?>']}}}:</strong> |
| 91 | <?php } ?> | 93 | <?php } ?> |
| 92 | <?php if ( $key === 'phone_number') { ?> | 94 | <?php if ( $key === 'phone_number') { ?> |
| 93 | <strong>Direct Line / Branch:</strong> | 95 | <strong>Direct Line / Branch:</strong> |
| 94 | <?php } ?> | 96 | <?php } ?> |
| 97 | <?php if ( $key === 'department_branch') { ?> | ||
| 98 | <# if ( user.department_email ) { #> | ||
| 99 | <a href='mailto:{{{user.department_email}}}'> {{{user['<?php echo $key;?>']}}}</a> | ||
| 100 | <# }else{ #> | ||
| 101 | {{{user['<?php echo $key;?>']}}} | ||
| 102 | <# } #> | ||
| 103 | <?php }else{ ?> | ||
| 95 | {{{user['<?php echo $key;?>']}}} | 104 | {{{user['<?php echo $key;?>']}}} |
| 105 | <?php } ?> | ||
| 106 | <?php } ?> | ||
| 96 | </div> | 107 | </div> |
| 97 | <# } #> | 108 | <# } #> |
| 98 | 109 | ... | ... |
-
Please register or sign in to post a comment