iA1
12-30-2018, 10:00 PM
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:
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>';
}
Plugin is Active: Yes
Click save. That's it.
Users will still be able to modify their timezone selection from their usercp -> General Settings.
Please "Mark as Installed (https://vbulletin.org/forum/vborg_miscactions.php?do=installhack&threadid=326998)" if you use this.
Donations (https://vbulletin.org/forum/showthread.php?t=326998&nojs=1#gtdonate) are always welcome
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:
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>';
}
Plugin is Active: Yes
Click save. That's it.
Users will still be able to modify their timezone selection from their usercp -> General Settings.
Please "Mark as Installed (https://vbulletin.org/forum/vborg_miscactions.php?do=installhack&threadid=326998)" if you use this.
Donations (https://vbulletin.org/forum/showthread.php?t=326998&nojs=1#gtdonate) are always welcome