0

After a lengthy break from WP i'm getting my hands dirty with quite a complex plugin which is coming along nicely, but right now i am at the point of needing some advice on quite a complex issue:

Project Outline Plugin is multi-functional with the core element being that it is a members based system focused on online rpg gaming, member signs up (members country is set on registration from a select option dropdown field), creates his/her profile and sets timezone within their profile, once profile is completed then the member has the option to join an existing group based on Country, Gaming Platform etc, or they can go ahead and create their own group and become group manager.

Being part of a group a member can then post a "mission, quest" etc, upon posting all group members are emailed with the details and a link to the post where they can join if interested.

The problem This is where i need some advice, the time of the "mission/quest" needs to be relevant to the group that its posted from, but timezones being timezones are not exactly country specific (ie one country can have many timezones), an example being the US both the user post and the email would need to show the time as in the coming example as 3.00pm EST or 3.00pm PST so that interested parties have a clear and concise information to the time the "mission/quest" commences.

The Question Is it possible to hook into the Wordpress timezones function (the one you see on wp install) or would you suggest going the laborious route and building my own?, if the WP option is recommended then where can i find info (im thinking codex but im finding nothing in there regarding the WP function) to put me on the right track, timezones are not my strong point and i've known from the outset that this part of the plugin would be my stumbling block, however its of the highest importance that it is integrated so that it is easier on the enduser and removes confusion.

1

This mission is almost impossible. Players do not stay at one timezone therefor associating a timezone with a player can result in misleading and confusing output.

What you can do is move all time to be expressed at a specific time base, lets say UTC, and write some JS that will translate the UTC time into the user's local time based on its browser/os settings by using the relevant JS APIs.

You can see this kind of system in action in the wordpress "make core" site https://make.wordpress.org/core/tag/agenda/ where they use a shortcode to express times that should be localized.

Obviously this will not work where you can not run JS like emails, so maybe for this you can ask users to set their "normal" timezone.

sidenote: players are usually actually very good in taking TZ into account, and while you can localize time to make it more convenient, people still need to know if it is work time, night or other significant time in the day. Therefor if you go with this kind of localization you need to be careful and leave the users some ability to express their local times when needed.

  • Hi Mark, thanks for the input and your opinion,. I am asking that users set their "normal timezone" as i feel that this would be the best basis to work from. I have seen a working example of this on another site (not a wp one) that when creating an account i set my timezone, then as long as i am logged in everything is returned to my view as being my local time, if i log out and then look at the same thing it will only show the time as set in the posters declared tz. site is the100.io, il leave this post as unanswered for a couple of hours just to garner more opinions and options, thanks again – MartinJJ Feb 16 '16 at 14:15
  • Ive marked as answered, i think from what you say i am over engineering this somewhat, it does'nt need to be so complicated, for one the email does not need to show the start time of the mission/quest as any interested party will just click the uri and be taken straight to the post, secondly i could (i'm thinking) have group timezone set on group creation by group creator for example "America/Los_Angeles" and members set their own relevant timezone, eg:America/Winnipeg and use group timezone as base to compare against group members timezones so that each member sees the time in their locale. – MartinJJ Feb 16 '16 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.