Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/CHANGELOG.txt,v
retrieving revision 1.7.4.38
diff -u -p -r1.7.4.38 CHANGELOG.txt
--- CHANGELOG.txt	15 Oct 2008 00:39:34 -0000	1.7.4.38
+++ CHANGELOG.txt	15 Oct 2008 00:47:59 -0000
@@ -6,6 +6,8 @@ Drupal vB x.x-x.x, xxxx-xx-xx
 
 Drupal vB 5.x-2.x, xxxx-xx-xx
 -----------------------------
+#290557 by sun: Fixed bad language and timezone set for users created via
+  DrupalvB.
 #308858 by smk-ka: Fixed user sessions sometimes not properly created in
   vBulletin due to a different vB behavior upon user login.
 #285718 by smk-ka: Added protection against timing problems on heavy Drupal
Index: drupalvb.admin-pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.admin-pages.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 drupalvb.admin-pages.inc
--- drupalvb.admin-pages.inc	16 Jul 2008 22:12:00 -0000	1.1.2.6
+++ drupalvb.admin-pages.inc	15 Oct 2008 00:43:37 -0000
@@ -50,14 +50,6 @@ function drupalvb_settings_integration()
     '#description' => t('Select to enable the account synchronization feature.'),
   );
 
-  $zones = _system_zonelist();
-  $form['drupalvb_default_timezone'] = array(
-    '#type' => 'select',
-    '#title' => t('Time zone'),
-    '#default_value' => variable_get('drupalvb_default_timezone', 0),
-    '#options' => $zones,
-    '#description' => t('Select the default timezone offset for created users.'),
-  );
 
   $roles = drupalvb_get_roles();
   $form['drupalvb_default_usergroup'] = array(
Index: drupalvb.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.inc.php,v
retrieving revision 1.9.4.21
diff -u -p -r1.9.4.21 drupalvb.inc.php
--- drupalvb.inc.php	15 Oct 2008 00:39:34 -0000	1.9.4.21
+++ drupalvb.inc.php	15 Oct 2008 00:44:57 -0000
@@ -143,10 +143,9 @@ function drupalvb_create_user($account, 
     $usertitle = 'Junior Member';
   }
 
-  // Grab the default timezone offset, divided by 3600 b/c the system.module
-  // timezone form is in seconds.
-  $timezone = variable_get('drupalvb_default_timezone', '-18000');
-  $timezone = intval($timezone) / 3600;
+  // Divide timezone by 3600, since vBulletin stores hours.
+  $timezone = variable_get('date_default_timezone', 0);
+  $timezone = ($timezone != 0 ? $timezone / 3600 : 0);
 
   // Default new user options: I got these by setting up a new user how I
   // wanted and looking in the database to see what options were set for him.
@@ -156,7 +155,7 @@ function drupalvb_create_user($account, 
   $usergroupid = variable_get('drupalvb_default_usergroup', '2');
 
   // Set up the insertion query.
-  $result = drupalvb_db_query("INSERT INTO {user} (username, usergroupid, password, passworddate, usertitle, email, salt, showvbcode, languageid, timezoneoffset, posts, joindate, lastvisit, lastactivity, options) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', 1, 1, '%s', 0, '%s', '%s', '%s', '%s')", drupalvb_htmlspecialchars($edit['name']), $usergroupid, $passhash, $passdate, $usertitle, $edit['mail'], $salt, $timezone, $joindate, time(), time(), $options);
+  $result = drupalvb_db_query("INSERT INTO {user} (username, usergroupid, password, passworddate, usertitle, email, salt, showvbcode, languageid, timezoneoffset, posts, joindate, lastvisit, lastactivity, options) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', 1, %d, '%s', 0, '%s', '%s', '%s', '%s')", drupalvb_htmlspecialchars($edit['name']), $usergroupid, $passhash, $passdate, $usertitle, $edit['mail'], $salt, drupalvb_get('languageid'), $timezone, $joindate, time(), time(), $options);
 
   $userid = db_last_insert_id('user', 'userid');
 
@@ -308,7 +307,7 @@ function drupalvb_get_roles() {
 /**
  * Get vB language id by given ISO language code.
  */
-function drupalvb_get_languageid($language) {
+function drupalvb_get_languageid($language = NULL) {
   static $vblanguages;
 
   if (!isset($vblanguages)) {
@@ -319,7 +318,7 @@ function drupalvb_get_languageid($langua
     }
   }
   $options = drupalvb_get('options');
-  return isset($vblanguages[$language]) ? $vblanguages[$language] : $vblanguages[$options['languageid']];
+  return (!empty($language) && isset($vblanguages[$language]) ? $vblanguages[$language] : $vblanguages[$options['languageid']]);
 }
 
 /**
