WordPress.org

Support

Support » Plugins and Hacks » Event Organiser » [Plugin: Event Organiser] eo display reoccurence

[Plugin: Event Organiser] eo display reoccurence

Viewing 15 replies - 1 through 15 (of 26 total)
  • You can ‘group occurrences’ to show only the next instance by using the group_events_by attribute:

    [eo_events group_events_by="series"]

    For the main event list – there should be an option in the plug-in settings. This will effect all the venue, category, and other event-archive pages.

    To show the recurrence summary is not possible with the event list shortcode. I’m afraid you’ll need to create a custom shortcode which handles this – or code in a loop into your theme.

    If you do decide to do either of those, I would do it as follows: (set ‘group_events_by’ to ‘series’ in the $args array).

    $events = eo_get_the_events( $args );
        if( $events ){
             foreach( $events as $event ){
                if( eo_reoccurs( $event->ID ){
                    //Event reoccurs - use eo_get_event_schedule()
                }else{
                    //Event is one off
                }
             }
        }

    Documentation for functions can be found here. Not everything is documented (including eo_get_event_schedule – for that see the source – its fairly well documented there).

    Alternatively you can use the eo_get_schedule_summary() function (passing the event post ID – which retrieves the summary you see in the admin.

    thank you for your quick reply.
    I´m working on a function to check out the right formats…
    is there a possibility to ask for the endday of the next occurence?
    thx su

    See this function. It takes the event (Post) ID and returns an array index by ‘start’ and ‘end’, with the values being php DateTime objects – corresponding to the next occurrence of that event. (Or false if there isn’t one).

    thanks that should work!

    yepp it worked,…

    only the order doesnt work no more:
    example(german date-format):
    04.10.12 von 19 bis 22 Uhr
    30.09. – 04.10.12
    03.10.12 von 16 bis 23 Uhr
    10.10. – 23.10.12 von 08 bis 16 Uhr
    09.10. – 12.10.12 von 09 bis 21 Uhr

    these are single and reoccurend events (I did cut off the the titles for a better overview here)

    my $args:
    ‘event_end_after’ => ‘today’,
    ‘order’ => ‘ASC’,
    ‘group_events_by’ => ‘series’,
    ‘orderby’ => ‘event-category’
    the result is the same if I change ASC to DESC

    do you have any clue, what could be the reason?
    thx su

    You can’t order by event-category unfortunately. The only orderby' values that are allowed are those supported byget_post()andeventstartandeventend`.

    sorry that was only a test.
    I also tested eventstart.
    with the same output

    <?php
    //INIT
    $event_args = array(
    /*
        //'numberposts' => 5,*/
    	'group_events_by' => 'series',
        'orderby' => 'eventstart',
        'event_end_after' => 'today',
        'order' => 'ASC'
    );
    $events = eo_get_events($event_args);
    if ($events):
        $return= '';
        global $post;
        $temp = $post;
    
        foreach ($events as $post):
    //Time-VARS
    	//	Check if is reoccurend
    	if(eo_reoccurs()){
    		//echo"ich komme wieder<br>";
    		//$dayOfWeek, $startDay, $startDayShort, $endDay, $endTime
    		//If the event is occurring again in the future, display the date
    		$dayOfWeek= eo_get_next_occurrence('l');
    		$startDay= eo_get_next_occurrence('d.m.y');
    		$startTime= eo_get_next_occurrence('H');
    		$startDayShort=eo_get_next_occurrence('d.m.');
    		$endDay=eo_format_date($post->EndDate,'d.m.y');
    		$endTime= eo_format_date($post->FinishTime,'H \U\h\r');
    
    	}else{
    		//echo"ich komme nur einmal<br>";
    		//$dayOfWeek, $startDay, $startDayShort, $endDay, $endTime
    		//single-event
    		$dayOfWeek= eo_get_schedule_start('l');
    		$startDay= eo_get_schedule_start('d.m.y');
    		$startTime= eo_get_schedule_start('H');
    		$startDayShort=eo_get_schedule_start('d.m.');
    		$endDay=eo_format_date($post->EndDate,'d.m.y');
    		$endTime= eo_format_date($post->FinishTime,'H \U\h\r');
    	}
    
    	//Check if is only one day or more days
    	if($startDay==$endDay){
    		//is only at one day
    		$givenDate=$startDay;//output Date = $startDay
    	}else{
    		//is on more than one day
    		$givenDate=$startDayShort.' - '.$endDay;//output Date = $startDayShort - $endDay
    	}
    	//Check if all day, set format accordingly
    	if( eo_is_all_day($post->ID) ){
    		//Date without time
    		$dateNTime=$givenDate;
    	}else{
    		//Date with time
    		//output dateNTime = $givenDate + Time
    		$dateNTime=$givenDate.' von '.$startTime.' bis '. $endTime;
    	}
    
    //EVENT-INFO
    	$eventTitle=$post->post_title;
    	$eventUrl=get_permalink($post->ID);
    	//$eventCat="";
    	//Check for current category-slug
    	$terms = get_the_terms( $post->ID, 'event-category' );
    	if ( $terms && ! is_wp_error( $terms ) ){
    		$su_event_cats = array();
    		foreach ( $terms as $term ) {
    			$su_event_cats[] = $term->slug;
    		}
    		$eventCat = join( ", ", $su_event_cats );
    		//echo $su_on_cat;
    	}
    
    //TEST-VARS
    	/*echo "startTime".$startTime."<br>";
    	echo "endTime".$endTime."<br>";
    	echo "startDay".$startDay."<br>";
    	echo "endDay".$endDay."<br>";
    	echo "dateNTime".$dateNTime."<br>";
    	echo "eventCat".$eventCat."<br>";
    	echo "eventTitle".$eventTitle."<br>";
    	echo "eventUrl".$eventUrl."<br><hr>";*/
    //DESIGN
    	echo '<div style="width:90%; margin:6px auto; padding:6px; border: 1px dotted #fff; ">';
    	//echo $eventCat;
    	echo '<h3><a title="'.$eventTitle.'" href="'.$eventUrl.'"><strong>'.$eventTitle.'</strong></a></h3>';
    	echo $dateNTime;
    	echo '</div>';
    
    	endforeach;
    	//Reset post variable
        $post = $temp;
    endif;
    ?>

    so now the full script.
    maybe there some errors?

    Hi susee – this seems to be working for me…?

    What exactly is the issue, does not order by date, or is it only ordering in descending order and doesn’t work for ascending? I pretty much copied and pasted your script, so if its not working – maybe it could be a plug-in conflict?

    it does not order by day
    nor by category.
    I don´t think it´s a plugin-conflict.
    even if all (that are only few) plugins are deactivated the problem is the same…

    here a output-list with better description:

    a long and reoccurend (1. category)
    09.10. – 12.10.12 von 09 bis 21 Uhr

    a short and reoccurend (2. category)
    03.10.12 von 16 bis 23 Uhr

    a long single event (3. category)
    10.10. – 23.10.12 von 08 bis 16 Uhr

    a short single event (1. category)
    04.10.12 von 19 bis 22 Uhr

    a long single event (3. category)
    30.09. – 04.10.12

    This one war produced with DESC…
    I dont see any order at all.

    p.s. thanks for your help 🙂

    hi Stephen,
    I tested the shortcode [eo_events group_events_by=”series”]
    on a nother page. The Output here is not correct as well:

    – long single event (3.category) am 30.09.12 (no end day)

    – one day single (1.category)event am 04.10.12 19:00 (no end time)

    -long single event(3.category)am 10.10.12 08:00 (no endday/time)

    – one day single reoccurend am 02.04.08 16:00 (first startday not the next and no end time)

    – long reoccurend am 11.09.12 09:00 (first startday not the next and no end time)

    Hi Susee,

    What do you mean by ‘no end day’? All events should have an end date/time.

    As for the previous lists, I’ve noticed that in the case of recurring events you are using the event’s ‘schedule start’ (i.e. when the event first started) rather than the current occurrence – and also eo_get_next_occurrence(). This could potentially cause distorted results.

    Try the following (this works for me using a variety of recurring and non-recurring events):

    <?php
    $event_args = array(
    	'group_events_by' => 'series',
        'orderby' => 'eventstart',
        'order' => 'desc'
    );
    
    	$events = eo_get_events($event_args);
    	if ($events):
    		global $post;
    		$temp = $post;
    		foreach ($events as $post):
    			echo eo_get_the_start('Y-m-d').'</br>';
    		endforeach;
    
    		//Reset post variable
        		$post = $temp;
    	endif;
    ?>

    I use the eo_get_next_occurrence only in case of reoccurence.
    Only if the event is a single event I use eo_get_schedule_start.

    The dates are correct in my script.
    But it is not nice when the dates are not ordered.
    If I only use [eo_events] without declining the series, the order is correct. But this brings the reoccurend events to take place over the complete event-list.
    The blog-users must be able to see the events in the correct order but not thousend instances of reoccuring events….
    With your last script the first occurence is shown, not the next and the order still isn´t correct.

    If a correct sorting isn´t possible, I´ve got to cut of the reoccurend events from the complete event-list. 🙁

    Or do you see a possibility to sort ist with the next occurence?

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘[Plugin: Event Organiser] eo display reoccurence’ is closed to new replies.
Skip to toolbar