[wp-hackers] peculiar problem on setting GMT

Otto otto at ottodestruct.com
Wed Apr 15 16:37:27 GMT 2009


On Wed, Apr 15, 2009 at 7:43 AM, SoJ Web <sojweb at indiana.edu> wrote:
> I was actually speaking to a related, but different issue: not displaying in
> the viewer's time zone, rather, displaying the author's time zone. So if the
> server is in central time, and I'm in eastern, the published dates for my
> posts will show my (eastern) time (while also displaying the GMT offset...
> otherwise it could get really confusing).

Ahh. Well, okay, for that you don't need any special display code at
all. Just a per-user timezone adjustment setting. Then, the post_date
will get set by the user values instead of the overall blog values,
and the_date() will display the author time more or less
automatically. If you want to get the gmt time of a post, you have to
use get_post_time() with the second parameter being true, just like
always.

This is even a relatively easy plugin to do. Just have a usermeta
value to store the user's timezone, then stick a filter onto
pre_option_gmt_offset to adjust the offset accordingly for the current
user. Done.


-Otto
Sent from Memphis, Tennessee, United States


More information about the wp-hackers mailing list