Blog

The time machine of BuddyPress taking everything nearby back to memory

终于搞明白了 BuddyPress 这个诡异的时间问题。

按照 web app 的常识,主程序设定用户时区便可以正常显示,然而在 BuddyPress 并不是这样,它是 WPMU 的一个插件,它的相对时间首先看齐于 group/forum/status/wire 这些 BuddyPress 组件,对于 WPMU 的 blog 组件实际上处于一个平行关系,再加上 WPMU 的多用户 blog,每个用户的 blog 有可能设置不同的时区,BuddyPress 产生时间混沌看上去是一件不可避免的事情,不过这并不是什么坏事,这只是产品成熟过程中的一个里程碑,目前来说,无论 BuddyPress 的站长身处哪个时区,都必须将主 blog (也就是 WPMU 安装时的默认初始 blog) 的时区对准服务器所在的时区,这看上去像一个内部框架向主框架的反包围,不过这确实解决了 BuddyPress 首页的全站动态 (Site Wide Activity) 时间线混乱的问题,唯一的副作用就是,凡是主 blog 的 post 时间都是服务器时间,而非用户身处的时区了。

Finally, we approached in a solution of this weird BuddyPress “since” time phenomenon.

Usually, the time/date mechanism of a web app will run responsively after the user timezone is set, that doesn’t happen to BuddyPress since it’s a plugin of WPMU, actually, it serves group/forum/status/wire components, and keeps a parallel relationship with WPMU, which is designed to be multi-user platform. Every user in a WPMU site could have his/her blog timezone set separately, this convenience has its little buddy plugin an inevitable destiny of timeline chaos. After all, that’s not so bad, it leads to a milestone of the product development.

For now, wherever the webmaster of a WPMU+BuddyPress community site is hosted, he/she will have no alternative but set the timezone of default blog (automatically created by WPMU installation) to notch the hosting server system time, which look like a subframework fights back its parent framework, but the phenomenon is eliminated, the “since” time in Site Wide Activity stream is back to peace again, regardless of the post on default admin blog being published on server time instead of the timezone user stays in.

4 responses to “The time machine of BuddyPress taking everything nearby back to memory”

  1. Andre Li Pan 说:

    善哉善哉, so far so good :)

  2. Kude Hen 说:

    鉴于北美在每年的4月至11月施行夏令时 (DST),因此服务器时区会在 UTC-7 和 UTC-6 之间切换,为站点的时间控制造成不必要的麻烦,因此放弃使用 UTC offset 时间设定,直接使用城市时间,由于服务器位于 Provo, Utah,而 Utah 省府盐湖城通常不在时区列表中,故切换至位于相同时区的 Denver, Colorado.

  3. zoe 说:

    目前我也正被这个问题困扰着。主Blog时区和服务器所在的时区设置一样了。。可全站活动那里显示的日志还是8小时之后才开始计算第一分钟。。而其它版块,如论坛和成员活动那里都能显示正常。。

    请问有什么好的解决办法吗?

    1. Kude Hen 说:

      目前官方没有什么解决方案,开发者群里也没有合适的解决方案,讲到底这是 WPMU 的 问题

Leave a Reply

Twitter 用户
请点击下方按钮并使用你的 Twitter 帐号信息登录本站