Map View / Event date Issue

Home Forums Calendar Products Events Calendar PRO Map View / Event date Issue

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #161568

    I found an issue in Map view where if you select a pin for a recurring event it will take you to a event details page of a future date rather than the next occurrence of the recurring event. any advice or fix would be greatly appreciated!

    #162440
    Barry
    Member

    Hi – sorry you’re hitting difficulties, here.

    I can certainly see the problem on your site yet can’t quite replicate it locally … I do see you already tried deactivating all other plugins and that you also switched to a default, unmodified theme – thanks for giving that a try! – can you confirm if that impacted on the problem at all, though?

    #162457

    yes, I have just turned off every plugin again except Event Calendar and switched to the WP default theme and still having the issue. The next event is May 18th and map link goes to June 1st.

    thanks for the response and help!!

    #163643
    Barry
    Member

    If you’re game, can we try an experiment? Could you add the following to your theme’s functions.php file?

    add_filter( 'tribe_events_ajax_response', 'adjust_map_markers' );
    
    function adjust_map_markers( $response_data ) {
    	if ( ! isset( $response_data['markers'] ) ) return $response_data;
    
    	$regular = array();
    	$recurring = array();
    	$final_date_segment = '#(\\d{4}-\\d{2}-\\d{2})/$#';
    
    	// Look at the existing markers and separate those for regular events and recurring events
    	// into two separate buckets
    	foreach ( $response_data['markers'] as $marker ) {
    		$parts = array();
    		preg_match( $final_date_segment, $marker['link'], $parts );
    
    		// Doesn't look like a recurring event? Add to the regular markers array
    		if ( ! is_array( $parts ) || count( $parts ) !== 2 ) {
    			$regular[] = $marker;
    		}
    
    		// If it *does* look like a recurring event store separately (keep the earliest version)
    		else {
    			$marker['recurrence'] = strtotime( $parts[1] ); // Date of recurrence
    			$identifier = $marker['venue_id'] . $marker['title'];
    			
    			// Overwrite an existing entry only if the date of the current entry is earlier
    			if ( isset( $recurring[$identifier] ) && $marker['recurrence'] < $recurring[$identifier]['recurrence'] )
    				$recurring[$identifier] = $marker;
    
    			// If it hasn't been added already, add it
    			elseif ( ! isset( $recurring[$identifier] ) )
    				$recurring[$identifier] = $marker;
    		}
    	}
    
    	// Re-combine regular and recurring event markers
    	$response_data['markers'] = array_values( array_merge( $regular, $recurring ) );
    	return $response_data ;
    }

    I think I see what the problem is and if that snippet resolves this for you (it may not, of course) that will be a good piece of confirmation and we can get this slated for a substantive fix in a future release.

    Let me know how you get on!

    #163759

    I have added the code and after some quick testing it seems to have done the trick! thanks for the help, and I will let you know if anything changes.

    #165958
    Barry
    Member

    Thank you for testing it and reporting back. So just as a bit of background detail there it looks like if there are multiple instances of a recurring event marker data for all of them is sent to the browser. Depending on their exact order, we could end up with a scenario like you described (and my snippet simply removes all recurring instance markers but the earliest for each event).

    In any case, glad that works for you and I’ll get this logged as something we need to address.

    #173935
    Leah
    Member

    Hi there,

    I just wanted to update you here. We were not able to fix this issue in time for our upcoming release (3.6). However, it is still very much a priority and we plan to work on it for a future maintenance release. We will keep you posted on our progress. Thank you for your patience and support!

    Best,
    Leah

    #987975
    Leah
    Member

    Hello,

    Thank you again for bringing this issue to our attention. We’re happy to say that we have added a fix for this into our upcoming version 3.11 release. Keep an eye on your Updates page for the new version. If you have any trouble with the update (or are still seeing this problem after you update) please start a new thread and we’d be happy to help out.

    Thank you for your patience while we got this release ready to go!

    Best,
    Leah
    and the rest of The Events Calendar team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Map View / Event date Issue’ is closed to new replies.