623de9b5 by Jeff Balicki

department_email

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 195e9714
......@@ -15868,4 +15868,9 @@ p.intro {
color: #aaa !important;
}
#um_field_467_phone_number_12,
#department_email-453 {
display: none !important;
}
/*# sourceMappingURL=child-theme.css.map */
\ 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 ) {
}
function wpa_91930() {
// if query var is not present just return
if ( ! isset( $_REQUEST['my_listener'] ) || 'update_fax' != $_REQUEST['my_listener'] ){
return;
}else{
echo "Started<br>";
$users = get_users( array( 'fields' => array( 'ID' ) ) );
foreach($users as $user){
$department_branch = get_user_meta( $user->ID, 'department_branch', true );
switch($department_branch){
case "Cranbrook Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 426 7370' );
break;
case "Commercial Department":
update_user_meta( $user->ID, 'phone_number_12', '250 426 0879' );
break;
case "Elkford Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 865 7537' );
break;
case "Sparwood Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 425 0047' );
break;
case "Fernie Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 423 9223' );
break;
case "Castlegar Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 365 2913' );
break;
case "Slocan Valley Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 226 7351' );
break;
case "Greenwood Branch":
update_user_meta( $user->ID, 'phone_number_12', '250 445 9902' );
break;
default:
echo "No department_branch set.<br>";
break;
}
add_filter( 'um_profile_field_filter_hook__department_email', 'um_get_department_email', 99, 2);
}
echo "Completed<br>";
exit;
}
function um_get_department_email( $data ) {
$arr = explode(">", $data);
$arr = explode("<", $arr[1]);
$data = $arr[0];
return $data;
}
add_action( 'init', 'wpa_91930' );
add_action( 'init', 'wpa_34245' );
function wpa_34245() {
// if query var is not present just return
if ( isset( $_REQUEST['my_listener'] ) || 'update_office_email' == $_REQUEST['my_listener'] ){
$users = get_users( array( 'fields' => array( 'ID' ) ) );
foreach($users as $user){
error_log("Updating user: ".$user->ID);
updte_office_email($user->ID);
}
}else if ( isset( $_REQUEST['my_listener'] ) || 'update_fax' == $_REQUEST['my_listener'] ){
$users = get_users( array( 'fields' => array( 'ID' ) ) );
foreach($users as $user){
update_branch_fax($user->ID);
}
}else{
return;
}
}
add_action( 'profile_update', function ( $user_id, $old_user_data ) {
update_office_email($user_id);
update_branch_fax($user_id);
}, 10, 2 );
function update_branch_fax($userID) {
// if query var is not present just return
$department_branch = get_user_meta($userID, 'department_branch', true );
switch($department_branch){
case "Cranbrook Branch":
update_user_meta( $userID, 'phone_number_12', '250 426 7370' );
break;
case "Commercial Department":
update_user_meta( $userID, 'phone_number_12', '250 426 0879' );
break;
case "Elkford Branch":
update_user_meta( $userID, 'phone_number_12', '250 865 7537' );
break;
case "Sparwood Branch":
update_user_meta( $userID, 'phone_number_12', '250 425 0047' );
break;
case "Fernie Branch":
update_user_meta($userID, 'phone_number_12', '250 423 9223' );
break;
case "Castlegar Branch":
update_user_meta( $userID, 'phone_number_12', '250 365 2913' );
break;
case "Slocan Valley Branch":
update_user_meta( $userID, 'phone_number_12', '250 226 7351' );
break;
case "Greenwood Branch":
update_user_meta($userID, 'phone_number_12', '250 445 9902' );
break;
default:
echo "No department_branch set.<br>";
break;
}
}
function update_office_email($userID) {
$department_branch = get_user_meta( $userID, 'department_branch', true );
switch($department_branch){
case "Administration Department":
update_user_meta( $userID, 'department_email', 'administration@stellervista.com' );
break;
case "Accounting Department":
update_user_meta( $userID, 'department_email', 'treasuryaccount@stellervista.com' );
break;
case "Commercial Department":
update_user_meta( $userID, 'department_email', 'commercial@stellervista.com' );
break;
case "Member Solutions Centre":
update_user_meta( $userID, 'department_email', 'msc@stellervista.com' );
break;
default:
break;
}
}
......
......@@ -231,4 +231,9 @@ box-shadow: 0 3px 6px rgb(0 0 0 / 16%);
cursor: default;
opacity: .4; }
.um-directory .um-members-pagination-box .um-members-pagi .pagei.none {
color: #aaa !important; }
\ No newline at end of file
color: #aaa !important; }
#um_field_467_phone_number_12,
#department_email-453{
display: none !important;
}
\ No newline at end of file
......
......@@ -5,7 +5,7 @@
Author: the Understrap Contributors
Author URI: https://github.com/understrap/understrap-child/graphs/contributors
Template: understrap
Version: 1.2.0058
Version: 1.2.0059
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap-child
......
......@@ -6,7 +6,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
<div class="um-members um-members-list">
<# if ( data.length > 0 ) { #>
<# _.each( data, function( user, key, list ) { #>
<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'; } ?>">
<span class="um-member-status {{{user.account_status}}}">
{{{user.account_status_name}}}
......@@ -41,7 +41,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
{{{user.hook_after_user_name}}}
</div>
<?php if ( $show_tagline && ! empty( $tagline_fields ) && is_array( $tagline_fields ) ) {
foreach ( $tagline_fields as $key ) {
if ( empty( $key ) ) {
......@@ -86,13 +86,24 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
<# if ( typeof user['<?php echo $key; ?>'] !== 'undefined' ) { #>
<div class="um-member-metaline um-member-metaline-<?php echo $key; ?>">
<?php if ( $key !== 'department_email') { ?>
<?php if ( $key !== 'phone_number') { ?>
<strong>{{{user['label_<?php echo $key;?>']}}}:</strong>
<?php } ?>
<?php if ( $key === 'phone_number') { ?>
<strong>Direct Line / Branch:</strong>
<?php } ?>
<?php if ( $key === 'department_branch') { ?>
<# if ( user.department_email ) { #>
<a href='mailto:{{{user.department_email}}}'>&nbsp;{{{user['<?php echo $key;?>']}}}</a>
<# }else{ #>
&nbsp;{{{user['<?php echo $key;?>']}}}
<# } #>
<?php }else{ ?>
&nbsp;{{{user['<?php echo $key;?>']}}}
<?php } ?>
<?php } ?>
</div>
<# } #>
......