Skip Navigation

[Resolved] Allow users setting local time zone in front end

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1181688

Hell, how can I set the WP the system field of user-setting-time into the front end, so that user can choose local time zone when logged in, because my site has an event calendar. must show up a accurate time to users

#1181692

Users will have a profile form to set the time zone up. that must connect with their system time. Thanks!

#1182039

Hi,

There isn't such a built-in feature within Toolset forms. I have tried it in a fresh wordpress installation + the latest version of Toolset plugins, for example: Dashboard-> Edit My Profile
There isn't a user field "time zone"

If it is site settings: Dashboard-> Settings-> General
option "Timezone".

Then it is not possible with Toolset form plugin, Toolset form can not edit your website settings, user form can only edit user's custom fields.

#1182044

I saw the button of manage No-Toolset field like wp_user-settings-time under the tab of Post form, maybe, you could test with this field? 如果真的不行的话,怎么解决这个时差问题而不需要用户使用后端呢?谢谢!

#1182047

如果你说的“wp_user-settings-time”用户field 是标准的WordPress用户field, 你也可以使用Toolset Forms来编辑它:
Dashboard-> Toolset-> User Forms
点击按钮“Manage non-Toolset User Fields”,参考我们的文档进行设置
https://toolset.com/documentation/user-guides/letting-cred-edit-custom-fields-created-by-other-plugins/

#1182053

我可以弄,但我不知道怎么样才会能使这个字段跟网站的系统字段联系起来呢?假设我设成一个单选字段,并手工填写时区,这样肯定是联系不上的,有显示时间的地方的话就会出错。有没有其他办法? 谢谢!

#1182057

你说的这个字段“wp_user-settings-time”是插件生成的吗?麻烦你提供一下插件下载地址,我在本机上测试一下回复你

#1182108

你说的没错,“wp_user-settings-time”字段是由Wordpress本身生成的,我在本机测试也有这个字段,但是这个字段存储的数据是时间戳格式,比如:
wp_user-settings-time: 1546937000
时间戳timestamp是一个指定时间,某年某月某日,所以它肯定不是存储时区(timezone)数据, 你可以使用mysql工具搜索这个字段。

我用谷歌搜索,但是没有找到与这个字段相关的文档这个。

然后我在搜索Wordpress源文件\wp-includes\option.php
找到了下面的代码:

		// The cookie is newer than the saved value. Update the user_option and leave the cookie as-is
		if ( $current > $last_saved ) {
			update_user_option( $user_id, 'user-settings', $cookie, false );
			update_user_option( $user_id, 'user-settings-time', time() - 5, false );
			return;
		}

这个字段应该是与用户更改自己的profile页面时间有关系。参考:
hidden link

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.