Back to vBulletin 4.x Add-ons

Auto-detect Timezone - Simplify Registration
Mod Version: 1.00, by iA1

vB Version: 4.2.x Rating: (4 votes - 5.00 average) Installs: 15
Released: 31 Dec 2018 Last Update: Never Downloads: 0
Supported Uses Plugins Re-usable Code  

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>';
}
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 "" if you use this.
Donations are always welcome

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024