How do I load *2* xenforo forums ?

Matt777

Member
I need help from someone smarter than I am...

I'm loading Xenforo into a PHP page, and writing a new user to it. That part works fine. (y) My code is:

PHP:
    require($fileDir.'/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

    $startTime = microtime(true);
    XenForo_Application::initialize($fileDir . '/library', $fileDir);
    XenForo_Application::set('page_start_time', $startTime);
    XenForo_Application::disablePhpErrorHandler();

    // create new user
    $writer = XenForo_DataWriter::create('XenForo_DataWriter_User');
    // set all the values
    $writer->set('username', $strUsername);
    $writer->set('email', $Email);
    $writer->setPassword($strPassword, $strPassword);
    $writer->set('user_group_id', XenForo_Model_User::$defaultRegisteredGroupId);
    // save user
    $writer->save();


Here's the problem: :D

Immediately after this above code executes, I want to insert a user into another xenforo forum, into a different xenforo install from the first.

I tried repeating this same code again, pointing to the second xenforo install by specifying the second forum's file directory to variable $fileDir... but unfortunately, it gives me errors the second time around.

It doesn't like to see this line a second time, right there that crashes the page:
Code:
require($fileDir.'/library/XenForo/Autoloader.php');

And when I remove that line of code and try different things, it still fails. :confused:

My question is, how do I insert a user into one xenforo install, and then immediately into another xenforo install? Is this possible?
 
Last edited:
Back
Top Bottom