XF 2.1 Bridging Forums

King Fox

Member
Hi,

Not quite sure if this is the correct board to be posting, but I've got a few questions in regards to bridging Xenforo. I've bridged Xenforo in the past during the v1.5 days, however, I'm unsure as to what the new file conversions are in 2.1.x. Here is some of the relevant code from my v1.5 bridge.


PHP:
 public function __construct() {
        define("XENFORO_PATH", INTEGRATION_FOLDER);

        require_once(XENFORO_PATH."/library/XenForo/Autoloader.php");

        XenForo_Autoloader::getInstance()->setupAutoloader(XENFORO_PATH . "/library");
        XenForo_Application::initialize(XENFORO_PATH . "/library");
        XenForo_Application::set('page_start_time', microtime(true));

        $this->session = XenForo_Session::startPublicSession();
        $this->visitor = XenForo_Visitor::getInstance();
        $this->database = XenForo_Application::getDb();
    }

public function login($name, $password, $remember = false) {
        $login_model = XenForo_Model::create('XenForo_Model_Login');
        $user_model = XenForo_Model::create('XenForo_Model_User');
        $tfa_model = XenForo_Model::create('XenForo_Model_Tfa');

        $response = null;
        $id = $user_model->validateAuthentication($name, $password, $response);

        if (!$id) {
            $login_model->logLoginAttempt($name);
            return false;
        }

        $login_model->clearLoginAttempts($name);

        if ($remember) {
            $user_model->setUserRememberCookie($id);
        }

        XenForo_Model_Ip::log($id, "user", $id, "login");

        $user_model->deleteSessionActivity(0, $_SERVER['REMOTE_ADDR']);

        $session = XenForo_Application::get('session');
        $session->changeUserId($id);
        XenForo_Visitor::setup($id);

        $this->visitor = XenForo_Visitor::getInstance();
        $userInfo = $user_model->getUserById($this->visitor->getUserId());
        return $userInfo;
    }

Any help is appreciated. Thanks.
 
Top Bottom