Support

Home Forums Community Forum Incorrect Event Time

Incorrect Event Time

Posted: April 14, 2016 at 2:10 am

Viewing 3 reply threads


ConnieV

April 14, 2016 at 2:10 am

I know there are several posts regarding incorrect timestamp on events. I understand there is another plugin that is causing my issue; however, not being too familiar with PHP, I’m not exactly sure how to fix it. I am using ajax event calendar, which is the culprit in my case. I searched in the edit area and came up this string of PHP code:

<strong>
 function localize_plugin($page) {
			load_plugin_textdomain(AEC_NAME, false, AEC_NAME . '/locale/');
			$timezone = get_option('timezone_string');
			if ($timezone) {
				date_default_timezone_set($timezone);
			} else {
				// TODO: look into converting gmt_offset into timezone_string
				date_default_timezone_set('UTC');
			}
			
			// localization: date/time
			if (get_option('timezone_string')) {
				$this->timezone = get_option('timezone_string');
			} else {
				$this->set_admin_alert(sprintf('<p>Ajax Event Calendar %s.<br>%s... <a href="http://www.travelmath.com/time-zone/" target="_blank"><strong>%s</strong></a>.</p>
					<h3><a href="' . admin_url() . 'options-general.php">%s</a></h3>'
				, __('requires a city value for the Timezone setting', AEC_NAME)
				, __("Not all cities are listed. Can't find your city in the timezone dropdown?", AEC_NAME)
				, __('Search for your standardized timezone.', AEC_NAME)
				, __('Update Blog Settings', AEC_NAME)));
</strong>

Is this the area that I would need to change coding? If so, can you tell me what should change and what I would replace it with? I can’t disable my calendar to use event registration, but also need my times to be correct. I have my WP time setting for USA – Denver, not UTC. Any help is greatly appreciated. Thanks!


Lorenzo Orlando Caum

  • Support Staff

April 14, 2016 at 8:01 am

Hi Connie,

Event Espresso stores date times as UTC and then uses the offset in the General Settings page to adjust to the local time zone. Using a city/region near you instead of a UTC option is recommended.

If you are seeing strange issues with the date times, then something on your site may be incorrectly using date_default_timezone_set().

Here are some resources that talk about this:

https://vip.wordpress.com/documentation/vip-development-tips-tricks/use-current_time-not-date_default_timezone_set/

http://www.taupecat.com/2010/10/using-time-in-your-wordpress-plugin/

http://weston.ruter.net/2013/04/02/do-not-change-the-default-timezone-from-utc-in-wordpress/

I would try reaching out to the theme developer if you are using a commercial theme and share the resources above with them.

Otherwise, try using current_time() instead of date_default_timezone_set().


Lorenzo


ConnieV

April 14, 2016 at 9:30 am

Hi Lorenzo – thanks for the response, but I don’t feel like you addressed my specific question. The issue is not a “theme” issue. As I stated in my first post, it is a plugin issue and I pasted the code I believe is the issue, but I am not familiar enough with code to simply say, “yes, this is the line I should adjust.”

Is there any way possible, you can actually look at the code I pasted in the post and confirm/deny that to be the issue? And, if it is the issue, can you tell me what line I need to change and what the change should be.

I appreciate the links, but they do me no good if I don’t know how to code PHP…

Thanks!


Lorenzo Orlando Caum

  • Support Staff

April 14, 2016 at 10:21 am

Hi Connie,

I can’t confirm if making the change for the references from date_default_timezone_set() to current_time() will correct the issue sitewide from that specific section of code.

Could you try reaching out the developer (author) and share the links that I shared with you?

This looks like it may be the plugin as I see the name (Ajax Event Calendar) in the block of code that you shared so you could create a support post there to let the author know:

https://wordpress.org/support/plugin/ajax-event-calendar

The other thing is if the above is the actual plugin, then any edits to the code would be lost once you update the plugin so it would be preferred to have the author correct this on their end.

Thanks


Lorenzo

Viewing 3 reply threads

The support post ‘Incorrect Event Time’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso