Version: , by wajones
Developer Last Online: Apr 2014
Version: 2.2.x
Rating:
Released: 08-05-2001
Last Update: Never
Installs: 17
No support by the author.
Update, script now accomplishes an automatic login to Inlink. The link didn't attach properly so I'll add it in a later post.
This is a hack to allow In-link to be somewhat integrated with vBulletin, what it does is...
1. Creates a new pending Inlink user at the same time as a new user registers for vBulletin.
2. Validate's the Inlink user when the vBulletin user validates by e-mail.
3. For existing vBulletin Users it creates a new inlink user when their vBulletin profile is updated.
4. Updates Inlink user when vBulletin profile is updated.
Your users will still have to log into Inlink, but they will have the same username and password. They will only have to log in to add a link.
If you validate a new user manually, when he updates his profile he will be validated in the Inlink Table or you can manualy validate in the inlink admin if you wish.
This hack is assuming the vBulletin Tables and Inlink Tables are in the same database.
Let me know if you find any bugs or typo's
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
In-Link integration with vBulletin hack
=======================================
Works with vbulletin 2.3.2 and InLink 2.3.1
What this hack does is enable's In-Link to use vBulletin user security.
When new members register in vbulletin the info is stored in the In-link table as well.
Also when the vBulletin password is changed it is changed in inlink as well.
Note: This does not work in reverse, the vbulletin user table is too extensive to attempt an inlink update to it.
So if you make a administration username or password change in Inlink it will invalidate the integration on that users.
The next time the user manages his vbulletin user account it will create a new user account in inlink.
I have added hacks to allow user creation, modification and removal in the vBulletin admin user utility.
1. CHANGES TO IN-LINK
1.1 Change to inlinks index.php
#### At the very top of the script after the <? php add the following. The chdir paths should match those of your server.
Some servers require full paths eg /www/mysite.com/forums
PHP Code:
// vBulletin integration
chdir( "../forums/");
include("global.php");
global $bburl, $bbuserinfo;
chdir( "../inlink");
// End vBulletin integration
1.2 Change to inlinks includes/init.php
PHP Code:
#### Find the following #####
//initialize all variables
$rs =&$conn->Execute("select name,value from inl_config");
while ($rs && !$rs->EOF)
{ $c_name = $rs->fields[0];
$c_value = $rs->fields[1];
$$c_name = $c_value;
$rs->MoveNext();
}
##### insert this after ####
PHP Code:
// Inlink to vBulletin integration hack
global $bbuserinfo,$DB_site;
// If not In-Link Admin
if ($admin != 1){
// If user is logged into vBulletin
if ($bbuserinfo['userid']!=0) {
$bbuserid = $bbuserinfo['userid'];
$username=$bbuserinfo['username'];
$password=$bbuserinfo['password'];
$email=$bbuserinfo['email'];
// If Logged in user has an existing InLink Account
if ($inlinkuser=$DB_site->query_first("SELECT user_name,user_pass,user_perm FROM inl_users WHERE user_name='$bbuserinfo[username]'")){
// Update the In-Link password if different than vBulletin
if ($inlinkuser['user_pass']!=$password){
$DB_site->query("UPDATE inl_users SET user_pass='$password' WHERE user_name='$bbuserinfo[username]'");
}
// Set user permissions per vBulletin usergroupid
if ($bbuserinfo['usergroupid']==6) {
// Admin
$user_perm=1;
}elseif ($bbuserinfo['usergroupid']==5 or $bbuserinfo['usergroupid']==7) {
// Editor
$user_perm=5;
}elseif ($bbuserinfo['usergroupid']==2) {
// Registered User
$user_perm=3;
}else{
// All other's Coppa, Waiting Email confirmation, etc...
$user_perm=0;
}
// Auto update user permissions if different than vBulletin usergroupid
// Comment this section out if you want to handle user permissions manually
if ($inlinkuser['user_perm']!=$user_perm){
$DB_site->query("UPDATE inl_users SET user_perm='$user_perm' WHERE user_name='$bbuserinfo[username]'");
}
// End of section to comment out if setting user permissions manually
// If user does not have In-Link user account, create one.
}else{
// Un-comment out the below line if you want to set user permissions manually
// $user_perm=3;
// Then comment out the next 9 lines if you want to set manually
if ($bbuserinfo['usergroupid']==6) {
$user_perm=1;
}elseif ($bbuserinfo['usergroupid']==5 or $bbuserinfo['usergroupid']==7) {
$user_perm=5;
}elseif ($bbuserinfo['usergroupid']==2) {
$user_perm=3;
}else{
$user_perm=0;
}
// End of lines to comment out to set user permissions manually
if ($user_perm!=0){
echo "Testing Not Found $username"; // Comment this out later once everything working OK.
mysql_query("INSERT INTO inl_users (user_name, user_pass, first, last, email, user_perm, user_date, user_status, user_pend, user_cust) values ('$username','$password','".addslashes(htmlspecialchars("vBulletin"))."','".addslashes(htmlspecialchars("User"))."','$email','$user_perm','".time()."','1','0','0')");
}
}
}
// auto log vBulletin User into inlink
if ($bbuserinfo['userid']!=0) {
$user = $bbuserinfo['username'];
$pass=$bbuserinfo['password'];
login($bbuserinfo['username'],$bbuserinfo['password']);
}
}
// End Inlink to vBulletin integration hack
1.3 Change to inlinks includes/functions_lib.php
PHP Code:
#### Find the following
$password=md5($password);
#### Replace it with the following
// Inlink to vbBulletin integration hack
global $admin;
if ($admin == 1){
$password=md5($password);
}
// End Inlink to vbBulletin integration hack
1.4 Change to inlinks header.tpl template
#### Add this to the top of header.tpl
Remember to change the chdir paths to those of your server.
PHP Code:
<?php
// Inlink to vbBulletin integration hack
chdir( "../forums");
global $bburl, $bbuserinfo;
chdir( "../inlink");
// End Inlink to vbBulletin integration hack
?>
1.5 Change to inlinks index.tpl template to disable user login and registration.
You want to force registration and login to vbulletin.
#### Find the following and comment out the <%insert_login%> ####
1.6 You will also want to go through the templates and comment out, remove all the links to the in-link
registration and login or change them to point to the vBulletin registration.
In particular you will need to change the menu_user.tpl template to remove the inlink login/registration/profile links.
################################################## ################################################## ##############
2. THIS NEXT PART HAS BEEN ADDED TO ALLOW UPDATING AND DELETING USERS FROM THE VBULLETIN ADMIN.
This is completely optional as you can use the inlink admin to delete and change inlink users.
Additionally the user oassword will be updated when a user enters inlink if it has been changed.
2.1 Open the vBulletin admin/user.php
#### find the following ####
PHP Code:
$DB_site->query("INSERT INTO user (userid,usergroupid,username,password,email,styleid,parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invisible,usertitle,customtitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,lastpost,posts,timezoneoffset,emailnotification,receivepm,emailonpm,ipaddress,pmpopup,options,birthday) VALUES (NULL,'$usergroupid','".addslashes(htmlspecialchars($ausername))."','".addslashes(md5($apassword))."','".addslashes(htmlspecialchars($email))."','$userstyleid','".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','$customtitle',$joindate,'$cookieuser','$daysprune',$lastvisit,$lastactivity,$lastpost,'$posts','$timezoneoffset','$emailnotification','$receivepm','$emailonpm','".addslashes($aipaddress)."','$pmpopup','$options','birthday')");
$userid=$DB_site->insert_id();
##### insert this after ####
PHP Code:
// inlink
$DB_site->query("INSERT INTO inl_users
(user_name, user_pass, first, last, email, user_perm, user_date, user_cust, user_status, user_pend)
values
('".addslashes(htmlspecialchars($ausername))."','".addslashes(md5($apassword))."','".addslashes(htmlspecialchars("vBulletin"))."','".addslashes(htmlspecialchars("User"))."','".addslashes(htmlspecialchars($email))."','3','".time()."','0','1','0')");
//inlnk
#### find the following ####
PHP Code:
$pwinclude="";
if ($apassword!="") {
$pwdinclude=",password='".addslashes(md5($apassword))."'";
}
#### replace it with the following ####
PHP Code:
$pwinclude="";
if ($apassword!="") {
$pwdinclude=",password='".addslashes(md5($apassword))."'";
//Inlink
$pwdinclude2 =",user_pass='".addslashes(md5($apassword))."'";
}
#### find the following ####
PHP Code:
$DB_site->query("DELETE FROM session WHERE userid='$userid'");
##### insert this after ####
PHP Code:
// Inlink to vbBulletin integration hack
$DB_site->query("DELETE FROM inl_users WHERE user_name='$user[username]'");
// End Inlink to vbBulletin integration hack