Next/Prev events on single page not going to correct event

Home Forums Calendar Products Events Calendar PRO Next/Prev events on single page not going to correct event

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1028410
    Craig
    Participant

    The next & previous links in the single event page don’t always go to the correct events

    Example if you look here
    http://www.wplgroup.com/aci/events/
    And look at “Designing The Smart Hospital”, you can see the previous event is “The Future Of Aromatics 2016 Amsterdam The Netherlands January” and the next event is “Lignofuels 2016”

    But if you go to the event
    http://www.wplgroup.com/aci/event/designing-the-smart-hospital/
    You can see the previous link is correct but the next link says “12th Vessel Efficiency & Fuel Management Summit” not “Lignofuels 2016”

    The issue I can see is that the next event has the same date as the current event

    Looking in Main.php I can see the function get_event_link that the next & previous links utilises:

    			if ( 'previous' === $mode ) {
    				$order      = 'DESC';
    				$direction  = '<';
    			} else {
    				$order      = 'ASC';
    				$direction  = '>';
    				$mode       = 'next';
    			}
    
    			$args = array(
    				'post__not_in'   => array( $post->ID ),
    				'order'          => $order,
    				'orderby'        => "TIMESTAMP( $wpdb->postmeta.meta_value ) ID",
    				'posts_per_page' => 1,
    				'meta_query'     => array(
    					array(
    						'key'     => '_EventStartDate',
    						'value'   => $post->EventStartDate,
    						'type'    => 'DATETIME',
    						'compare' => $direction,
    					),
    					array(
    						'key'     => '_EventHideFromUpcoming',
    						'compare' => 'NOT EXISTS',
    					),
    					'relation'    => 'AND',
    				),
    			);
    

    So the link is looking for the next event by a date that is greater (or less if previous) than the current date so will miss out the actual next event as the date is the start date is the same

    Is there a way around this?

    Cheers
    Andy

    #1028778
    Brian
    Member

    Hi,

    Thanks for using our plugins. I can help out here.

    This is actually a bug we just discovered ourselves.

    I have added you to the bug report to notify you through this thread when we have an update.

    Right now I do not have a work around for this issue.

    However, you could try modifying the core file and changing > to >= and < to <=.

    I am not 100% certain that will work, but it could be worth a shot.

    Let me know if you have any follow up questions.

    Thanks

    #1029373
    Craig
    Participant

    Hi

    Thanks for the reply
    I did a test with adding an equal to the direction but the previous and next come out as the same result
    I’ll keep an eye out for the bug report

    Cheers
    Andy

    #1029656
    Brian
    Member

    Ok well it was worth a shot.

    I am going to close this ticket to new replies, but the issue is still open and we will update this ticket once we release a fix.

    If you have any new questions or issues please create a new ticket and reference this one.

    Thanks

    #1042531
    Geoff
    Member

    Hey there,

    Great news–we have a fix for this issue ready and it will be shipping today in version 4.0.2. Please keep your eyes peeled for the update and let us know if any other issues pop-up in a new thread and we’d be happy to help.

    Thanks again for your patience while we worked on this!

    Cheers,
    Geoff

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Next/Prev events on single page not going to correct event’ is closed to new replies.