vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Board Optimization - Auto-detect Timezone - Simplify Registration (https://vborg.vbsupport.ru/showthread.php?t=326998)

iA1 12-30-2018 10:00 PM

Auto-detect Timezone - Simplify Registration
 
1 Attachment(s)
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 "Mark as Installed" if you use this.
Donations are always welcome

iA1 12-31-2018 06:48 PM

Reserved for updates

scottkoz20 01-01-2019 02:35 AM

works - no issues! Thanks

gnrx 01-10-2019 06:46 AM

Installed, fantastic mod!


All times are GMT. The time now is 06:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00996 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete