Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

I this is an old thread but I too need user specific timezone setting. Here is a plugin that "WP User Level Timezone" will hopefully fit the needs of some looking for a user specific setting.

https://wordpress.org/plugins/wp-utz/

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top