• Resolved latcomsystems

    (@latcomsystems)


    This placeholder used to open an .ICS file, with SAVE or OPEN options for users, now it just opens up a browser page with VCALENDAR text right in the browser. Users are unable to simply save or open it with outlook.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • It’s possible this is a conflict caused by your theme or another plugin. To check if it is, can you test with all other plugins deactivated and while running the default WordPress theme?

    Thread Starter latcomsystems

    (@latcomsystems)

    That didn’t make a difference. You can check here:
    http://thoughtgallery.org/events-2/
    Click on any of the iCal links in the list of events. It takes you to a browser page with VCALNDAR code instead of opening a file.

    This is what the formatting looks like:

    <tr>

    <td width=”150″>

    #_EVENTDATES<br/>

    #_EVENTTIMES

    </td>

    <td width=”*”>

    #_EVENTLINK

    {has_location}<br/><i>#_LOCATIONLINK, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}

    </td>

    <td width=”50″>#_EVENTICALLINK</td>

    </tr>

    In that case, I’d say the problem is likley to be that your web server isn’t configured correctly to serve iCal files as a downloadable file. Instead, it’s sending the content straight to the browser.

    This is something you’d need to contact your hosting company about.

    @latcomsystems how did you resolve issue?

    Thread Starter latcomsystems

    (@latcomsystems)

    @pyrostevejr The plugin code is incorrect. I created my own function that overrides the one in the plugin and generates the ical files correctly.

    Would you be willing to share that?

    Thread Starter latcomsystems

    (@latcomsystems)

    function lcs_em_ical_item(){
    	global $wpdb, $wp_query, $wp_rewrite;
    	//check if we're outputting an ical feed
    	if( !empty($wp_query) && $wp_query->get('ical') ){
    		$execute_ical = false;
    		$filename = 'events';
    		$args = array();
    		//single event
    		if( $wp_query->get(EM_POST_TYPE_EVENT) ){
    			$event_id = $wpdb->get_var('SELECT event_id FROM '.EM_EVENTS_TABLE." WHERE event_slug='".$wp_query->get(EM_POST_TYPE_EVENT)."' AND event_status=1 LIMIT 1");
    			if( !empty($event_id) ){
    				$filename = $wp_query->get(EM_POST_TYPE_EVENT);
    				$args['event'] = $event_id;
    			}
    		//single location
    		}elseif( $wp_query->get(EM_POST_TYPE_LOCATION) ){
    			$location_id = $wpdb->get_var('SELECT location_id FROM '.EM_LOCATIONS_TABLE." WHERE location_slug='".$wp_query->get(EM_POST_TYPE_LOCATION)."' AND location_status=1 LIMIT 1");
    			if( !empty($location_id) ){
    				$filename = $wp_query->get(EM_POST_TYPE_LOCATION);
    				$args['location'] = $location_id;
    			}
    		//taxonomies
    		}else{
    			$taxonomies = EM_Object::get_taxonomies();
    			foreach($taxonomies as $tax_arg => $taxonomy_info){
    				$taxonomy_term = $wp_query->get($taxonomy_info['query_var']);
    				if( $taxonomy_term ){
    					$filename = $taxonomy_term;
    					$args[$tax_arg] = $taxonomy_term;
    				}
    			}
    		}
    		//only output the ical if we have a match from above
    		if( count($args) > 0 ){
    			//send headers and output ical
    			header('Content-type: text/calendar; charset=utf-8');
    			header('Content-Disposition: attachment; filename="'.$filename.'.ics"');
    			em_locate_template('templates/ical.php', true, array('args'=>$args));
    			exit();
    		}else{
    			//no item exists, so redirect to original URL
    			$url_to_redirect = preg_replace("/ical\/$/",'', esc_url_raw(add_query_arg(array('ical'=>null))));
    			wp_redirect($url_to_redirect, '302');
    			exit();
    		}
    	}
    }
    remove_action('parse_query', 'em_ical_item');
    add_action ( 'parse_query', 'lcs_em_ical_item', 1 );
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘#_EVENTICALLINK not working correctly’ is closed to new replies.