update to assignment script
Showing
1 changed file
with
25 additions
and
2 deletions
| ... | @@ -33,6 +33,8 @@ if ( class_exists( 'WP_CLI' ) ) { | ... | @@ -33,6 +33,8 @@ if ( class_exists( 'WP_CLI' ) ) { |
| 33 | global $wpdb; | 33 | global $wpdb; |
| 34 | $broker_posts = $wpdb->get_results('select post_author,ID from wp_posts where post_type = "broker"',OBJECT_K); | 34 | $broker_posts = $wpdb->get_results('select post_author,ID from wp_posts where post_type = "broker"',OBJECT_K); |
| 35 | 35 | ||
| 36 | $sub_cat_assignments = []; | ||
| 37 | |||
| 36 | // $current_assignment_count = get_option('options_assignments'); | 38 | // $current_assignment_count = get_option('options_assignments'); |
| 37 | $iter_counter = 0; | 39 | $iter_counter = 0; |
| 38 | foreach($staff_members as $assign) { | 40 | foreach($staff_members as $assign) { |
| ... | @@ -66,9 +68,18 @@ if ( class_exists( 'WP_CLI' ) ) { | ... | @@ -66,9 +68,18 @@ if ( class_exists( 'WP_CLI' ) ) { |
| 66 | } | 68 | } |
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | var_dump($new_option_values);exit; | 71 | $option_value = $new_option_values; |
| 72 | $sub_cat = trim($assign['sub_category']); | ||
| 73 | |||
| 74 | $assign['sub_category'] = str_replace(' ', '_',$assign['sub_category']); | ||
| 75 | $assign['sub_category'] = str_replace('#', '',$assign['sub_category']); | ||
| 76 | $assign['sub_category'] = str_replace('/', '',$assign['sub_category']); | ||
| 77 | |||
| 78 | |||
| 79 | if($sub_cat == 'farm team #1' || $sub_cat == 'farm team #2' || $sub_cat == 'commercial team #1' || $sub_cat == 'commercial team #2' || $sub_cat == 'commercial team #3') { | ||
| 80 | $sub_cat_assignments[$sub_cat] = $option_value; | ||
| 81 | } | ||
| 70 | 82 | ||
| 71 | $option_value = serialize($new_option_values); | ||
| 72 | } | 83 | } |
| 73 | 84 | ||
| 74 | update_option($option_name, $option_value); | 85 | update_option($option_name, $option_value); |
| ... | @@ -79,6 +90,18 @@ if ( class_exists( 'WP_CLI' ) ) { | ... | @@ -79,6 +90,18 @@ if ( class_exists( 'WP_CLI' ) ) { |
| 79 | 90 | ||
| 80 | } | 91 | } |
| 81 | 92 | ||
| 93 | // var_dump( $sub_cat_assignments['commercial team #1']);exit; | ||
| 94 | update_option('options_farm_1_broker_assignment', $sub_cat_assignments['farm team #1']); | ||
| 95 | update_option('options_farm_2_broker_assignment', $sub_cat_assignments['farm team #2']); | ||
| 96 | update_option('options_comm_1_broker_assignment', $sub_cat_assignments['commercial team #1']); | ||
| 97 | update_option('options_comm_2_broker_assignment', $sub_cat_assignments['commercial team #2']); | ||
| 98 | update_option('options_comm_3_broker_assignment', $sub_cat_assignments['commercial team #3']); | ||
| 99 | |||
| 100 | //a:1:{i:0;s:5:"73040";} | ||
| 101 | //s:452:"a:35:{i:0;i:73040;i:1;i:73044;i:2;i:73045;i:3;i:73046;i:4;i:73047;i:5;i:73050;i:6;i:73051;i:7;i:73053;i:8;i:73057;i:9;i:73058;i:10;i:73061;i:11;i:73064;i:12;i:73066;i:13;i:73067;i:14;i:73070;i:15;i:73071;i:16;i:73072;i:17;i:73074;i:18;i:73076;i:19;i:73083;i:20;i:73086;i:21;i:73087;i:22;i:73088;i:23;i:73089;i:24;i:73090;i:25;i:73092;i:26;i:73094;i:27;i:73095;i:28;i:73098;i:29;i:73099;i:30;i:73100;i:31;i:73102;i:32;i:73103;i:33;i:73106;i:34;i:73110;}"; | ||
| 102 | |||
| 103 | update_option('options_assignments', $iter_counter); | ||
| 104 | |||
| 82 | // } | 105 | // } |
| 83 | 106 | ||
| 84 | // syncBrokerListToPosts(); | 107 | // syncBrokerListToPosts(); | ... | ... |
-
Please register or sign in to post a comment