623de9b5 by Jeff Balicki

department_email

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 195e9714
...@@ -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 // if query var is not present just return
225 if ( ! isset( $_REQUEST['my_listener'] ) || 'update_fax' != $_REQUEST['my_listener'] ){
226 return;
227 }else{
228 echo "Started<br>";
229 $users = get_users( array( 'fields' => array( 'ID' ) ) );
230 foreach($users as $user){
231 $department_branch = get_user_meta( $user->ID, 'department_branch', true );
232 switch($department_branch){
233 case "Cranbrook Branch":
234 update_user_meta( $user->ID, 'phone_number_12', '250 426 7370' );
235 break;
236 case "Commercial Department":
237 update_user_meta( $user->ID, 'phone_number_12', '250 426 0879' );
238 break;
239 case "Elkford Branch":
240 update_user_meta( $user->ID, 'phone_number_12', '250 865 7537' );
241 break;
242 case "Sparwood Branch":
243 update_user_meta( $user->ID, 'phone_number_12', '250 425 0047' );
244 break;
245 case "Fernie Branch":
246 update_user_meta( $user->ID, 'phone_number_12', '250 423 9223' );
247 break;
248 case "Castlegar Branch":
249 update_user_meta( $user->ID, 'phone_number_12', '250 365 2913' );
250 break;
251 case "Slocan Valley Branch":
252 update_user_meta( $user->ID, 'phone_number_12', '250 226 7351' );
253 break;
254 case "Greenwood Branch":
255 update_user_meta( $user->ID, 'phone_number_12', '250 445 9902' );
256 break;
257 default:
258 echo "No department_branch set.<br>";
259 break;
260 }
261 224
262 } 225
263 echo "Completed<br>"; 226
264 exit; 227 function um_get_department_email( $data ) {
265 } 228 $arr = explode(">", $data);
266 229 $arr = explode("<", $arr[1]);
230 $data = $arr[0];
231 return $data;
267 } 232 }
268 233
269 add_action( 'init', 'wpa_91930' );
270 234
235 add_action( 'init', 'wpa_34245' );
271 236
237 function wpa_34245() {
238 // if query var is not present just return
239 if ( isset( $_REQUEST['my_listener'] ) || 'update_office_email' == $_REQUEST['my_listener'] ){
240 $users = get_users( array( 'fields' => array( 'ID' ) ) );
241 foreach($users as $user){
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 );
268 switch($department_branch){
269 case "Cranbrook Branch":
270 update_user_meta( $userID, 'phone_number_12', '250 426 7370' );
271 break;
272 case "Commercial Department":
273 update_user_meta( $userID, 'phone_number_12', '250 426 0879' );
274 break;
275 case "Elkford Branch":
276 update_user_meta( $userID, 'phone_number_12', '250 865 7537' );
277 break;
278 case "Sparwood Branch":
279 update_user_meta( $userID, 'phone_number_12', '250 425 0047' );
280 break;
281 case "Fernie Branch":
282 update_user_meta($userID, 'phone_number_12', '250 423 9223' );
283 break;
284 case "Castlegar Branch":
285 update_user_meta( $userID, 'phone_number_12', '250 365 2913' );
286 break;
287 case "Slocan Valley Branch":
288 update_user_meta( $userID, 'phone_number_12', '250 226 7351' );
289 break;
290 case "Greenwood Branch":
291 update_user_meta($userID, 'phone_number_12', '250 445 9902' );
292 break;
293 default:
294 echo "No department_branch set.<br>";
295 break;
296 }
297 }
298
299
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:
316
317 break;
318 }
319
320 }
272 321
......
...@@ -231,4 +231,9 @@ box-shadow: 0 3px 6px rgb(0 0 0 / 16%); ...@@ -231,4 +231,9 @@ box-shadow: 0 3px 6px rgb(0 0 0 / 16%);
231 cursor: default; 231 cursor: default;
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; }
...\ No newline at end of file ...\ No newline at end of file
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
......
...@@ -6,7 +6,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?> ...@@ -6,7 +6,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
6 <div class="um-members um-members-list"> 6 <div class="um-members um-members-list">
7 <# if ( data.length > 0 ) { #> 7 <# if ( data.length > 0 ) { #>
8 <# _.each( data, function( user, key, list ) { #> 8 <# _.each( data, function( user, key, list ) { #>
9 9
10 <div id="um-member-{{{user.card_anchor}}}-<?php echo esc_attr( $unique_hash ) ?>" class="um-member um-role-{{{user.role}}} {{{user.account_status}}} <?php if ( $cover_photos ) { echo 'with-cover'; } ?>"> 10 <div id="um-member-{{{user.card_anchor}}}-<?php echo esc_attr( $unique_hash ) ?>" class="um-member um-role-{{{user.role}}} {{{user.account_status}}} <?php if ( $cover_photos ) { echo 'with-cover'; } ?>">
11 <span class="um-member-status {{{user.account_status}}}"> 11 <span class="um-member-status {{{user.account_status}}}">
12 {{{user.account_status_name}}} 12 {{{user.account_status_name}}}
...@@ -41,7 +41,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?> ...@@ -41,7 +41,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
41 41
42 {{{user.hook_after_user_name}}} 42 {{{user.hook_after_user_name}}}
43 </div> 43 </div>
44 44
45 <?php if ( $show_tagline && ! empty( $tagline_fields ) && is_array( $tagline_fields ) ) { 45 <?php if ( $show_tagline && ! empty( $tagline_fields ) && is_array( $tagline_fields ) ) {
46 foreach ( $tagline_fields as $key ) { 46 foreach ( $tagline_fields as $key ) {
47 if ( empty( $key ) ) { 47 if ( empty( $key ) ) {
...@@ -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}}}'>&nbsp;{{{user['<?php echo $key;?>']}}}</a>
100 <# }else{ #>
101 &nbsp;{{{user['<?php echo $key;?>']}}}
102 <# } #>
103 <?php }else{ ?>
95 &nbsp;{{{user['<?php echo $key;?>']}}} 104 &nbsp;{{{user['<?php echo $key;?>']}}}
105 <?php } ?>
106 <?php } ?>
96 </div> 107 </div>
97 <# } #> 108 <# } #>
98 109
......