Support

Home Forums Event Espresso Premium Timezone issue?

Timezone issue?

Posted: July 12, 2013 at 8:09 am


Desmond Williams

July 12, 2013 at 8:09 am

Hello, I searched the forums and couldn’t resolve my issue, so hopefully you can help.

We run webinars that are always set at 1:00 – 2:00 pm Eastern (although we are located in Salt Lake City).

I’ve gone through the start up documentation and setting up an event seems pretty easy. I’ve entered all the needed criteria and set the start time at 1 pm and the end time at 2 pm.

It occurred to me that the system must think I mean that time to be for the Mountain Timezone, so I’ve set it to allow me to have a custom timezone for the event, which I set to New York (to account for the Eastern Timezone).

After doing so, it seems nothing has changed. It still says 1 pm to 2 pm for the event on the actual registration page. This is fine for people in the Eastern Timezone, but for someone in the Mountain Timezone it should be 11 am to 12 pm.

Does that make sense? Am I not understanding how this works correctly? If not, could you help me achieve my goal (set a start time for the Eastern Timezone and have it show correctly in the timezone you are in)?

Thanks in advance.

Edit:

I’m running

Espresso version 3.1.33.3.P (no add-ons)
Wordpress WP 3.5.2

Installed Plugins

Akismet by Automattic version 2.5.8,
Event Espresso by Event Espresso version 3.1.33.3.P,
Premise by Copyblogger Media LLC version 2.5,
W3 Total Cache by Frederick Townes version 0.9.2.11,
WordPress SEO by Joost de Valk version 1.4.13,
Types – Complete Solution for Custom Fields and Types by ICanLocalize version 1.3.1,
WP Views by ICanLocalize version 1.2.3


Josh

  • Support Staff

July 12, 2013 at 12:21 pm

Hi Desmond,

The custom timezone feature isn’t designed to display the start time of the event based on the user’s time zone. In a nutshell it is designed to allow for managing events in different timezones. It does not by default alter the way times are displayed on the registration form.

Making it change the times that are displayed on the fly (based on the time zone settings of the device the visitor’s browser is using) would require some custom development.

The first step would be to add some JavaScript to the registration page that detect’s the device’s time zone setting. There are ready made scripts out there that can be used. Here is one example:

https://github.com/scottwater/jquery.detect_timezone

The a script could be added to replace the time that’s displayed on the page with the custom value.

This would take some time and development resources to accomplish this customization, which isn’t something we can offer via the support forums.

A simpler solution that I can help you with is to change the start time & end time labels so that they specify the actual time zone the times are set to.

If you open up the custom-files add-on’s custom_functions.php or your current WP theme’s functions.php you can add this code to change the labels to display the abbreviation for Eastern time:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
    	'Start Time:' => 'Start Time: (ET)',
    	'End Time: ' => 'End Time: (ET)',
        // Add some more strings here if you'd like
    );
 
    // See if the current string is in the $strings array
    // If so, replace it's translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = &get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );

Alternatively, if you really wanted to modify the display of how the times get displayed you could edit the markup that’s in event-espresso/includes/functions/time_date.php that starts on line 204.


Desmond Williams

July 12, 2013 at 2:10 pm

Thanks Josh, you really helped clear things up.

I won’t pretend to know much what I’m doing with PHP or Javascript (although I’m quite comfortable with CSS and HTML).

What I’ve opted for is your very last suggestion “Alternatively, if you really wanted to modify the display of how the times get displayed you could edit the markup that’s in event-espresso/includes/functions/time_date.php that starts on line 204.”

So what I have done is the following:

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>if ($wpdb->num_rows == 1) {
$html .= $label == 1 ? '<span class="span_event_time_label">' . __('Start Time:', 'event_espresso') . '</span>' : '';
foreach ($event_times as $time) {
$html .= '<span class="span_event_time_value">' . event_date_display($time->start_time, get_option('time_format')) . ' Eastern</span>';
$html .= $label == 1 ? '<br/><span class="span_event_time_label">' . __('End Time: ', 'event_espresso') . '</span>' : __(' to ', 'event_espresso');
$html .= '<span class="span_event_time_value">' . event_date_display($time->end_time, get_option('time_format')) . ' Eastern</span>';
$html .= '<input type="hidden" name="start_time_id' . $multi_name_adjust . '" id="start_time_id_' . $time->id . '" value="' . $time->id . '" />';
}
} else if ($wpdb->num_rows > 1) {

Basically all I did was add the word ” Eastern” to both the start and end times. Does this look ok? Again, I really am just making an educated guess as to where I should insert “Eastern” (although it seems to be working on my registration page).

If this looks good to go, I have a few questions:

– This really is just cosmetic so it won’t affect my Registration Start and End times right? If that is the case, then the Registration Start and End times that I input are based off my actual timezone (Denver being the case), correct? Or can I set the custom time-zone to New York (Eastern) and the Registration Start and End times will be based off that?

– I assume with any plugin updates, I’ll have to reinstate the changes I’ve made?

– Is this the most simple solution? Really all I need is for someone to visit the page, see that the webinar starts at 1:00 – 2:00 pm Eastern, then register based off that knowledge.

Sorry for the questions or if I’m not thinking it through correctly.

Thanks again.


Josh

  • Support Staff

July 12, 2013 at 3:44 pm

Hi Desmond,

The code you posted looks good to me. I’ll follow up with your follow up questions:

– This really is just cosmetic so it won’t affect my Registration Start and End times right? If that is the case, then the Registration Start and End times that I input are based off my actual timezone (Denver being the case), correct? Or can I set the custom time-zone to New York (Eastern) and the Registration Start and End times will be based off that?

It is a cosmetic change. To be honest, it will display the times to enter and I don’t think it will factor in the timezone set below it. From what I can tell is the timezone selector is for event managers usage to keep track of events that happen on different time zones.

– I assume with any plugin updates, I’ll have to reinstate the changes I’ve made?

You can actually copy this function into the custom_functions.php file and it will load from there. So if you download the custom files add-on and upload the custom_functions.php file to /wp-content/uploads/espresso/ you can run your modified code from there.

Here’s how this works: If you look at the beginning of the event_espresso_time_dropdown function there’s this line:

if (!function_exists('event_espresso_time_dropdown')) {

This means it’s pluggable and you can override it. To do that copy the entire modified function starting with the above line and down to its closing } to custom_functions.php.

Then when you update, it will continue to run. This isn’t a function that gets changed often, but if for some reason it gets changed in a future version your custom function will need to be updated too.

– Is this the most simple solution? Really all I need is for someone to visit the page, see that the webinar starts at 1:00 – 2:00 pm Eastern, then register based off that knowledge.

I think it’s a good solution. One thing that I thought about with the idea of displaying the device’s time zone would be it could confuse people. For example, if I’m out on the West coast one and making plans to attend this event, the event time will display as my local time at that moment, which could get confusing.


Desmond Williams

July 12, 2013 at 4:38 pm

Awesome. Thanks for the response.

I could see how time-zone settings could get confusing — I suppose its a series tradeoffs (and maybe I’m in the minority in that I’m using this software exclusively for webinars).

Thanks again, have a great weekend.

The support post ‘Timezone issue?’ 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