admin管理员组文章数量:1122846
Let's say I have a multisite network running with Buddypress and has Gravity Forms installed with the GF User Registration addon. During new user/site registration, is there ANY way I can have the user set their time zone by selecting from a Gravity Form drop down menu the timezone they want?
Basically, I don't want the user to have to login to WP and then go to General settings to change their time zones. Is there any way of achieving this without having to edit any core WP code?
Let's say I have a multisite network running with Buddypress and has Gravity Forms installed with the GF User Registration addon. During new user/site registration, is there ANY way I can have the user set their time zone by selecting from a Gravity Form drop down menu the timezone they want?
Basically, I don't want the user to have to login to WP and then go to General settings to change their time zones. Is there any way of achieving this without having to edit any core WP code?
Share Improve this question edited Dec 26, 2013 at 15:18 Denis Lam asked Dec 21, 2013 at 12:55 Denis LamDenis Lam 711 silver badge6 bronze badges 8 | Show 3 more comments1 Answer
Reset to default 1Quoting from How to get WordPress Time Zone setting? you can set the option 'gmt_offset'
with the appropriate offset from UTC.
You should add the option to control it only in you site creation form. If you put it also on user which registers to an existing site (like the main site) users will be able to change the setting on creation, something that only the admin should be able to do.
If your form calls wpmu_new_blog()
you can set that option on blog creation from the data given in the form.
function wpse_127265_timezone( $blog_id )
{
switch_to_blog( $blog_id );
update_option('gmt_offset',$_POST['gmt_offset']);
restore_current_blog();
}
add_action( 'wpmu_new_blog', 'wpse_127265_timezone' );
If that data is part of the registration form (meaning that the site is created only after the user activated it) then things get a little more complex and you need to store the data at some other place until the activation is done.
本文标签: multisitePossible to set new user39s site time zone at user creation using Gravity Forms
版权声明:本文标题:multisite - Possible to set new user's site time zone at user creation using Gravity Forms? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736291590a1928756.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
date_default_timezone_set('America/Los_Angeles');
However, I do not want a global timezone change for the network, I want it to be specific per user. Any pointers would be appreciated. Thank you in advance! – Denis Lam Commented Dec 23, 2013 at 21:38