Bug Fix for the DrupalVb Module

Bug Fix for the DrupalVb Module

The current DrupalVB Module 5.x-1.1. It has the following bug. The dual login for login in the user in vbulletin when they login in the drupal is not working.

Before the line 

 return;

in the function “_drupalvb_set_login_cookies” in the script drupal/modules/drupalvb/drupalvb.inc.php

 Add the following code

$idhash = md5($_SERVER[’HTTP_USER_AGENT’] . fetch_substr_ip($_SERVER[’REMOTE_ADDR’]));

  $result = db_query(_drupalvb_prefix(”REPLACE INTO {session} (sessionhash, userid, host, idhash, ”
                    .”lastactivity, location, useragent, styleid, languageid, loggedin, ”
                    .”inforum, inthread, incalendar, badlocation, bypass, profileupdate) VALUES ”
                    .”(’”.md5(’drupalvb’ . $userid).”‘, ‘”.$userid.”‘, ‘”.$_SERVER[’REMOTE_ADDR’].”‘, ‘”.$idhash.”‘, ”
                    .”‘”.time().”‘, ‘index.php’, ‘”.$_SERVER[HTTP_USER_AGENT].”‘, 0, 0, 1, 0, 0, 0, 0, 0, 0  )”));
 

Then add this function at the end of the script drupalvb.inc.php of the drupalvb module of drupal

function fetch_substr_ip($ip, $length = null)
{
 if ($length === null OR $length > 3)
 {
  $length = 1;
 }
 return implode(’.', array_slice(explode(’.', $ip), 0, 4 - $length));
}

Then remove the following line in the function drupalvb_user_login() in the script drupal/modules/drupalvb/drupalvb.module

$userinfo = db_fetch_array($result);

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.