1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I load *2* xenforo forums ?

Discussion in 'XenForo Development Discussions' started by Matt777, Dec 21, 2013.

  1. Matt777

    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: Dec 21, 2013
  2. Itworx4me

    Itworx4me Well-Known Member

  3. Matt777

    Matt777 Member

    Oooh :eek: that's a pretty cool looking plugin... but probably feature overkill for what I'm doing. My one forum is retired, read-only, so users don't need to remain synchronized or anything that complicated. I'd like a simpler solution that can be done with a few line changes to the PHP code.
     

Share This Page