• Resolved bojates

    (@bojates)


    Hi,

    I’m trying to build an events calendar for an online community and the members are based in multiple time zones. I saw a question from about 3 years ago about this, but can’t see anything more recent about anyone getting this working. Ideally I’d like the users to be able to set their time zone and see the events in their local time. But it would also be ok for the users to be able to set a time zone when they create an event, and display that. (Users will be creating events in multiple time zones as well as attending them.)

    Is this now supported, and I’m missing it? Or any advice on how to get it working?

    I’m managing my members using BuddyPress, if that makes a difference, and am using the free edition of Events Manager, but would happily go pro to solve this problem!

    Thanks,

    Jemima

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Jemima,

    This isn’t supported out-of-the-box but it might be something you can do with custom coding.

    One way would be to get the users timezone as they load the page, then use jQuery or Javascript to adjust the event time / date displayed on the page as needed.

    Thread Starter bojates

    (@bojates)

    I’ll give it a go, thanks.

    Thread Starter bojates

    (@bojates)

    I’m having good progress with this it would be a lot easier if I could get the UTC date of the event into the page to manipulate. Ideally, I’d like to be able to bring in the UTC date as an attribute in a tag, and display the local date. Then I’ll use JavaScript, with the user’s set timezone to change the display date. I can see the UTC date is used in the ical, but I can’t find a way to expose it into the regular template. Is there a UTC equivalent of #_EVENTDATES that I could get at? (Hoping for an undocumented feature ??

    Thank you!

    The event date placeholder can be formatted using PHP date options, which include UTC formatting, maybe that would help.

    https://wp-events-plugin.com/documentation/placeholders/

    Another option would be to create a custom attribute to store the event date in UTC.

    https://wp-events-plugin.com/documentation/event-attributes/

    Thread Starter bojates

    (@bojates)

    For anyone else wanting to do this, I went the route of formatting the date using the PHP date options (I had totally missed this was possible in all the fields) and then manipulating these values using Moment Timezone. I’ve written a plugin and have it working on a site at the moment.

    The plugin is here if you want to go this route, too:

    https://github.com/bojates/events-manager-timezone

    Constructive feedback on how to better structure either the plugin or the JavaScript would be appreciated.

    Thread Starter bojates

    (@bojates)

    I’ve modified this plugin to use the filter hooks provided by Events Manager. It now modifies the event using PHP and the cookie set by the user to reset event start and end dates and times to the user’s timezone. This means the calendar view still works because Events Manager can then deal with the event as it normally would.

    I’ve got it working by using the hooks em_get_event and em_events_get_array.

    Are there any other areas that pull the event data from the database?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Time zones for events with BuddyPress’ is closed to new replies.