Forum Replies Created

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter Friedrich72

    (@friedrich72)

    Saving with this:

    add_filter('em_event_save','my_em_groups_event_save',1,2);
    function my_em_groups_event_save($result,$EM_Event){
    	global $wpdb;
    	$my_em_groups = (is_array(get_option('my_em_groups'))) ? get_option('my_em_groups'):array();
    	if( $result && !empty($_POST['event_groups']) ){
    		$ids_to_add = array();
    		$EM_Event->groups = array();
    		foreach( $_POST['event_groups'] as $group_id ){
    			if( array_key_exists($group_id, $my_em_groups) ){
    				$ids_to_add[] = "({$EM_Event->id}, 'event-group', '$group_id')";
    				$EM_Event->groups[] = $group_id;
    			}
    		}
    		//First delete any old saves
    		$wpdb->query("DELETE FROM ".EM_META_TABLE." WHERE object_id='{$EM_Event->id}' AND meta_key='event-group'");
    		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;
    }

    tried adding this below it in addition

    add_filter('em_event_save_events','my_em_groups_rec_event_save',1,2);
    function my_em_groups_rec_event_save($result,$EM_Event){
    global $wpdb;
    	$my_em_groups = (is_array(get_option('my_em_groups'))) ? get_option('my_em_groups'):array();
    	if( $result && !empty($_POST['event_groups']) ){
    		$ids_to_add = array();
    		$EM_Event->groups = array();
    		foreach( $_POST['event_groups'] as $group_id ){
    			if( array_key_exists($group_id, $my_em_groups) ){
    				$ids_to_add[] = "({$EM_Event->id}, 'event-group', '$group_id')";
    				$EM_Event->groups[] = $group_id;
    			}
    		}
    		//First delete any old saves
    		$wpdb->query("DELETE FROM ".EM_META_TABLE." WHERE object_id='{$EM_Event->id}' AND meta_key='event-group'");
    		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;
    }

    I’m missing something, I know. The tables for recurring event “groups” aren’t being created. So it has to be obtaining the recurring event id’s and inserting VALUES for them. I tried defining events which have the current recurrence_id with something like this

    $my_recurring_id = $wpdb->query("SELECT recurrence_id FROM ". EM_EVENTS_TABLE ." WHERE  event_id ='{$EM_Event->id}' ");
    	$my_rec_event_id = $wpdb->query("SELECT event_id FROM ". EM_EVENTS_TABLE ." WHERE $my_recurring_id = recurrence_id ");

    And then using those in the delete / insertion queries but no result.
    Thanks for your thoughts.

    Thread Starter Friedrich72

    (@friedrich72)

    sorry, yes.

    In the tutorial you created a meta box in which you can check the desired style when registering an event.
    I added an additional meta box that is displayed for recurring events by changing this (fyi, I have changed “styles” to “groups” in all instances):

    function my_em_groups_meta_boxes(){
    	add_meta_box('em-event-groups', 'Groups', 'my_em_groups_metabox',EM_POST_TYPE_EVENT, 'side','low');
    
    }

    to this

    function my_em_groups_meta_boxes(){
    	add_meta_box('em-event-groups', 'Groups', 'my_em_groups_metabox',EM_POST_TYPE_EVENT, 'side','low');
    	add_meta_box('em-event-groups', 'Groups', 'my_em_groups_metabox','event-recurring', 'side','low');
    }

    My question is, how do I make the meta box save the selections for recurring events? Right now it is not applying the checked values. I have to go back to each single event to apply the values.

    Thread Starter Friedrich72

    (@friedrich72)

    Thanks again for your thoughts. I feel like I am close so I’ll continue to test following your comment on em_events.php.

    Thread Starter Friedrich72

    (@friedrich72)

    Thank you for the responses.
    @agelonwl, yes I am using events-list.php.

    I realized the problem is due to further modifications that I am trying to work in with $output. I reloaded a fresh install this morning just to make sure I was testing properly and results were normal.
    If I increase the default limit to something really high I have no problems. So a lower limit was dividing my results up strangely per-page because of the modifications.

    @marcus, what I need to accomplish, I dont think exists for functionality as far as what I have read in forums. FYI- I am displaying hours of operation for appx 45 locations that are open all year. Treating each location as an event.
    I need to display events on one page in groups by category and have them be searchable. ie…
    Search Form
    A-Eventlist
    B-Eventlist
    C-Eventlist
    D-Eventlist

    Ideally I’d like to use shortcodes but the [event_search_form] appears to have no effect on something like [events_list category=”86″ scope=”today”] in the event page. Is there a way to hook the short code for the search form into the short codes in the event page? That would solve all my dilemmas.

    Please dont be too hard on my work here.:) Just trying to work it out…
    What I ended up doing was creating custom placeholders A,B,C,D.
    Example for A:

    add_filter('em_event_output_placeholder','mygroup_em_placeholder',1,3);
    function mygroup_em_placeholder($replace, $EM_Event, $result){
    	if ( $result == '#_MYGROUP' ) {
    		ob_start();
    		$template = em_locate_template('placeholders/mygroup.php', true, array('EM_Event'=>$EM_Event));
    		$replace = ob_get_clean();
    	}
    	return $replace;
    }

    and in mygroup.php

    $mygroups = $wpdb->get_results("SELECT * FROM wp_terms WHERE term_group = 111 AND name = '$eventname'");
    
    	foreach($mygroups as $mygroup):
    	echo '<div id="location"><div class="name"><a href="'. $eventurl.'">' .$mygroup->name.'</a></div><div class="time">'.$starttime.' - '.$endtime.'</div><div class="location">'.$location.'</div></div>';
    
    	endforeach;

    Modified Admin/em_optioins.php to allow 3 new formats, ie format2, format 3 and format 4 ( I know this is where it gets a little crazy)

    em_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format2', __( 'The format of any events in a list.', 'dbem' ).$events_placeholder_tip );
    and same for _format3, _format4. Created tables in the database accordingly.

    Then modified classes/em_events.php to include the new formats and also added additional outputs 2,3,4

    $format = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format' ) : $args['format'] ;
    $format2 = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format_2' ) : $args['format'] ;
    $format3 = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format_3' ) : $args['format'] ;
    $format4 = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format_4' ) : $args['format'] ;

    And

    $output = "";
    		$events = apply_filters('em_events_output_events', $events);
    		if ( $events_count > 0 ) {
    			foreach ( $events as $EM_Event ) {
    				$output .= $EM_Event->output($format);
    $output2 .= $EM_Event->output($format2);
    $output3 .= $EM_Event->output($format3);
    $output4 .= $EM_Event->output($format4);
    
    			}

    I didnt need to add headers for each output.

    I’m sure you both can think of a cleaner way to accomplish this.
    All of the mods actually work great except for the break in the search result as described in my original post.
    Any help would be much appreciated. We are testing this software out for our uses but would be very willing to upgrade to pro if you think we can accomplish our goal.

    Thread Starter Friedrich72

    (@friedrich72)

    Follow up: Two interesting occurances;
    1st>The problem only happens when I search all categories. If I choose a specific category, results are good, pagination is good.

    2nd>The missing results are showing up on Page two of results. Partial Tuesday, Dec 4th results are on page one. It continues to show partial resutls for each date up to the 14th on page two.
    Then it starts over on page two with Tuesday, Dec 4th again, only showing the results that were not displayed on page 1.

    Pointing more towards pagination issue?

    Thread Starter Friedrich72

    (@friedrich72)

    Follow up: the search has the same effect without using the custom placeholder. If I use #_EVENTLINK OR #_EVENTNAME instead it does the same.

    Yes, it’s possible. Although you can’t do it directly by changing the css to point to the .swf file.
    I did it using the kimili plug in and then used a suggestion from this site https://www.trap17.com/index.php/Flash-Movie-Background_t9115.html that recommends this bit of css “<div id=”layer” style=”position:absolute; width:’100%’; height:’100%’; z-index:100; left: 1px; top: 1px”> “.

    After a few hours of tweeking the styles to make the layers display properly it appears to work.

    You can see the beginnings of something that I am designing here. The title of the page is a layer on top of the flash image. https://www.chadbeatty.com/jfoures

Viewing 7 replies - 16 through 22 (of 22 total)