By fumbling on
We're opting for a minimalist sign-up page and would like to hide the "locale settings" / time-zone section, but I don't see how to do so through user settings or logintobbogan. Am I missing a setting? If not, any thoughts on the easiest way to do this through editing a file? Thanks for any help.
Comments
The easiest way is to form_alter or theme it out
The easiest way is to either implement form_alter in a custom module, check for the "user_edit" form and then
unset($form['timezone']);- or - in your theme layer, template.php, implement :the second option is probably the easiest as you don't have to create a new module etc - don't forget to clear your theme registry cache (just visit admin/build/modules and this should happen magically) before your theme override will take affect.
Mike,
Computerminds offer Drupal development, consulting and training
Mike,
Computerminds offer Drupal development, consulting and training
Hi, It`s happen magically
Hi,
It`s happen magically onlly for user 1 but can you help how to apply for all users,
Thanks
Thanks, I'll try that.
Thanks, I'll try that.
http://auction/admin/settings
http://auction/admin/settings/date-time
here User-configurable time zones: change to disable
Works
Bang on - thanks for the heads up.
unset will cause problems
It's best to use exer's suggestion as unsetting the item causes the following watchdog error:
array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in date_timezone.module on line 153.
I found this while thread,
I found this thread, tried that path and learned it had moved in Drupal 7.
/admin/config/regional/settings
Is where you can find it now.
Thanks
That would have taken a while to find :)
That worked for me too, could
That worked for me too, could not have found out without this thread!
Raj Pawan G
This is the easiest solution.
This is the easiest solution. Thanks.
this moved to
nvm
follow me on Twitter: https://twitter.com/ABaumeier
hook_form_FORM_ID_alter()
Just did some research on this myself...
The best way in D7 would actually be to use hook_form_user_register_form_alter(). The problem with that is that the timezone field is inserted by a sibling hook, system_form_user_register_form_alter().
Since "s" is a very late letter in the alphabet, that hook will always be executed after yours. So, you would have to use another hook, hook_module_implements_alter(), to change the execution order. But it turns out you can't do that in this case, thanks to a bug in drupal core (#765860: drupal_alter() fails to order modules correctly in some cases).
However, if you really just want to remove the timestamp all together, you could use the same method to completely unregister the system hook inserting the component:
That will effectively get rid of the timezone element, but it's not a very safe way of implementing it, as you can't know what other stuff might be put into system_form_user_register_form_alter() in the future.
Up the module weight.
Hi,
I know this is old, but I was just trying to do the exact same thing and came across the fix that works. If you are using a custom module with hook_form_user_profile_form_alter - you need to set the weight of your module to something like, say 100. Once I went into my DB and changed my modules weight in the system table, I was able to see the timezone array in my dsm($form) and target it to remove it. However, once I went through all the work of figuring this out, we opted to just strongarm the configurable_timezone variable to default it to 0 instead.
Hope this helps.
Please delete
Please delete
-
-
Drupal Developer @Dropsolid
admin/config/regional/settings
The correct admin path for Drupal 7 is: admin/config/regional/settings
where you can un-check the option "Users may set their own time zone."
Drupal Developer @Dropsolid
In drupal 8
In drupal 8 also admin path is: admin/config/regional/settings
where we can un-check the option "Users may set their own time zone." Its working for me in drupal 8.