Auto-detect Timezone - Simplify Registration
I believe registration should be fast and simple. Almost all major social media accounts do not ask users to their timezone during registration and they still show content with the correct timestamp.
This plugin autodetects users' timezone during registration and hides that option from the registration form. To install, go to your admincp and under Plugins & Products, click on Add New Plugin option. https://www.yourdomain.com/admincp/plugin.php?do=add Product: vBulletin Hook Location: parse_templates Title: Autodetect timezone during registration Execution Order: 5 Plugin PHP Code: Code:
if (THIS_SCRIPT == 'register') { $template_hook['footer_javascript'] .= ' <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js" > </script> <script type="text/javascript" > var tz = jstz.determine(); // Determines the time zone of the browser client var timezone = tz.name(); var sel = document.getElementById("sel_timezoneoffset"); var tz1 = timezone.split("/").pop(); var i = 0; for (i = 0; i < sel.options.length; ++i) { if (sel.options[i].text.indexOf(tz1) > -1) { sel.options[i].selected = true; break; } } if (i == sel.options.length) { var d = new Date(); var n = d.getTimezoneOffset() / -60; for (i = 0; i < sel.options.length; ++i) { if (sel.options[i].value == n) { sel.options[i].selected = true; break; } } } sel.parentElement.style.display = "none"; </script>'; } Click save. That's it. Users will still be able to modify their timezone selection from their usercp -> General Settings. Download No files for download. |