Announcement

Collapse
No announcement yet.

The problem of logging into vBulletin forums via external application.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wayne Luke
    replied
    This isn't really a pre-sales question. Please ask the owner of your license to add your email to their priority forum support form so we can provide support in the proper area for your version of vBulletin.

    Leave a comment:


  • The problem of logging into vBulletin forums via external application.

    Hello everybody.
    I have a third party application which does the authentication and wants to log the user into a locally installed vBulletin instance at the same time. The only way to log in is via this third party app. This is what I have where $vbpath is the path to the vBulletin installation and $username is the name of the user to log in:

    Code:
    require_once($vbpath . '/includes/vb5/autoloader.php');
    \vB5_Autoloader::register($vbpath);
    \vB5_Frontend_Application::init('config.php');
    \vB::getDbAssertor()->delete('session', array('sessionhash' => \vB::getCurrentSession()->get('dbsessionhash')));
    $username = \vB_String::htmlSpecialCharsUni($username);
    $userinfo = \vB::getDbAssertor()->getRow('user', array('username' => $username));
    $auth = array_intersect_key($userinfo, array_flip(['userid', 'lastvisit', 'lastactivity']));
    $loginInfo = \vB_User::processNewLogin($auth);
    \vB5_Auth::setLoginCookies($loginInfo);
    at first sight it seems to work but I am wondering: is there anything else that needs to be done to properly log into vBulletin 5? I bypassed the API because it seemed the API requires the password and quickly becomes a mess if I store it in the third party app -- it needs to be encrypted using the third party password obviously and it's just a huge syncing mess which I didn't really need.
    Thank you very much!
    Author: du lich viet
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X