styles uncheck
-
I created this function to add styles to recurring events based on the walkthrough. I only have one style to choose from and I can’t uncheck it. I dont understand why the ‘…!empty($_POST[‘event_styles’])’ isnt checking for an empty box. I tried adding ‘… !empty($_POST[‘event_styles’]) && isset($_POST(‘event_styles’])’.
I was wondering if you could point me in the right direction to be able to ‘uncheck’ the box?
Heres the Save recurring styles function:add_filter('em_event_save','my_em_styles_recurring_event_save',1,2); function my_em_styles_recurring_event_save($result,$EM_Event){ global $wpdb; $my_em_styles = (is_array(get_option('my_em_styles'))) ? get_option('my_em_styles'):array(); if( $result && !empty($_POST['event_styles']) ){ $ids_to_add = array(); $EM_Event->styles = array(); foreach( $_POST['event_styles'] as $style_id ){ if( array_key_exists($style_id, $my_em_styles) ){ if( $EM_Event->is_recurring() ){ $receventids = $wpdb->get_col('SELECT event_id FROM '.EM_EVENTS_TABLE.' WHERE recurrence_id='.$EM_Event->id ); foreach ($receventids as $receventid){ $ids_to_add[] = "({$receventid}, 'event-style', '$style_id')"; $EM_Event->styles[] = $style_id; }}else{ $ids_to_add[] = "({$EM_Event->id}, 'event-style', '$style_id')"; $EM_Event->styles[] = $style_id; }} } //First delete any old saves $wpdb->query("DELETE FROM ".EM_META_TABLE." WHERE object_id={$EM_Event->id} AND meta_key='event-style'"); if( count($ids_to_add) > 0 ){ $wpdb->query("INSERT INTO ".EM_META_TABLE." (object_id, meta_key, meta_value) VALUES ".implode(',',$ids_to_add)); } } return $result; }
Thanks for the help.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘styles uncheck’ is closed to new replies.