Find the auth_get_user sub and replace it with the code below - the plugin on our site is modified a lot more than this but I've extracted just the part you need to get the vBulletin ID added to the User table.
# -------------------------------------------------------------------
# This function returns a user with Links SQL info. You should modify
# this code if you also want access to the vBulletin information.
#
my $args = shift;
GT::Plugins->action(STOP); # Make sure we don't run the main code.
my $user_db = $DB->table('Users');
my $user = $user_db->get($args->{Username});
if (! $user) {
$user->{Username} = $args->{Username};
$user->{Password} = ' ';
my $sth = $AUTH_DBH->prepare('SELECT email FROM ' . $VB_CFG->{tableprefix} . 'user WHERE username = ?');
$sth->execute($args->{Username});
my ($email) = $sth->fetchrow_array;
my $sth = $AUTH_DBH->prepare('SELECT userid FROM ' . $VB_CFG->{tableprefix} . 'user WHERE username = ?');
$sth->execute($args->{Username});
my ($id) = $sth->fetchrow_array;
$user->{vbID} = $id;
$user->{Email} = $email;
$user->{Name} = '';
$user->{ReceiveMail} = 'No';
$user->{Status} = 'Registered';
my $defaults = $user_db->default();
foreach (keys %$defaults) {
$user->{$_} = $defaults->{$_} unless (exists $user->{$_});
}
$user_db->insert($user) or Links::fatal("Unable to auto-create user: $args->{Username}. Reason: $GT::SQL::error");
}
return $user;
}
You will also need to add a new INT field to the User table, call it vbID and it should work fine.
Code:
sub auth_get_user { # -------------------------------------------------------------------
# This function returns a user with Links SQL info. You should modify
# this code if you also want access to the vBulletin information.
#
my $args = shift;
GT::Plugins->action(STOP); # Make sure we don't run the main code.
my $user_db = $DB->table('Users');
my $user = $user_db->get($args->{Username});
if (! $user) {
$user->{Username} = $args->{Username};
$user->{Password} = ' ';
my $sth = $AUTH_DBH->prepare('SELECT email FROM ' . $VB_CFG->{tableprefix} . 'user WHERE username = ?');
$sth->execute($args->{Username});
my ($email) = $sth->fetchrow_array;
my $sth = $AUTH_DBH->prepare('SELECT userid FROM ' . $VB_CFG->{tableprefix} . 'user WHERE username = ?');
$sth->execute($args->{Username});
my ($id) = $sth->fetchrow_array;
$user->{vbID} = $id;
$user->{Email} = $email;
$user->{Name} = '';
$user->{ReceiveMail} = 'No';
$user->{Status} = 'Registered';
my $defaults = $user_db->default();
foreach (keys %$defaults) {
$user->{$_} = $defaults->{$_} unless (exists $user->{$_});
}
$user_db->insert($user) or Links::fatal("Unable to auto-create user: $args->{Username}. Reason: $GT::SQL::error");
}
return $user;
}
You will also need to add a new INT field to the User table, call it vbID and it should work fine.