Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Auto-detect Timezone - Simplify Registration Details »»
Auto-detect Timezone - Simplify Registration
Version: 1.00, by iA1 iA1 is offline
Developer Last Online: Jul 2023 Show Printable Version Email this Page

Category: Board Optimization - Version: 4.2.x Rating:
Released: 12-30-2018 Last Update: Never Installs: 15
Supported Uses Plugins
Re-useable 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 "Mark as Installed" if you use this.
Donations are always welcome

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
Hostboard, TheLastSuperman

Comments
  #2  
Old 12-31-2018, 06:48 PM
iA1 iA1 is offline
 
Join Date: Jul 2018
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reserved for updates
Reply With Quote
  #3  
Old 01-01-2019, 02:35 AM
scottkoz20 scottkoz20 is offline
 
Join Date: Dec 2015
Location: Lewiston, NY
Posts: 344
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works - no issues! Thanks
Reply With Quote
  #4  
Old 01-10-2019, 06:46 AM
gnrx gnrx is offline
 
Join Date: Apr 2009
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed, fantastic mod!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:15 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04123 seconds
  • Memory Usage 2,252KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (2)post_thanks_box_bit
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete