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

Integration with Existing Site

Discussion in 'XenForo Development Discussions' started by Hardcore, Feb 25, 2012.

  1. Hardcore

    Hardcore Active Member

    Greetings!

    We've successfully installed XenForo and migrated 285k+ users to it. And our existing site with non-forum user content is now in sync with xf_user and XenForo's user authentication. Next step: integrating to the two sites.

    I've seen a few posts on using the XenForo header and footer, but nothing overly concise. Does anyone have any tips on how to make this happen somewhat easily?

    Thanks, Todd
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Which software is your existing site using?

    There is a WP style, there is also a generic add-on for creating header content on external pages.

    Alternatively you can wrap your XenForo installation in a wrapper, making it match your existing site.

    Which way do you want to go?
     
  3. Hardcore

    Hardcore Active Member

    It's all custom php code. We'd want to make the existing site sync-up with XenForo as much as possible.

    Thanks.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

  5. Hardcore

    Hardcore Active Member

  6. Hardcore

    Hardcore Active Member

    Hmm. Not working. I'm already using this code for user authentication.

    PHP:
    define('XF_ROOT'$_SERVER['DOCUMENT_ROOT'] . '/community'); // set this!
    define('TIMENOW'time());
    define('SESSION_BYPASS'false); // if true: logged in user info and sessions are not needed
     
    require_once(XF_ROOT '/library/XenForo/Autoloader.php');
     
    XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT '/library');
     
    XenForo_Application::initialize(XF_ROOT '/library'XF_ROOT);
    XenForo_Application::set('page_start_time'TIMENOW);
    XenForo_Application::disablePhpErrorHandler();
    XenForo_Application::setDebugMode(false);
     
    if (!
    SESSION_BYPASS){
      
    XenForo_Session::startPublicSession();
      
    $visitor XenForo_Visitor::getInstance();
      if(
    $visitor->getUserId()){
        
    $userModel XenForo_Model::create('XenForo_Model_User');
        
    $userinfo $userModel->getFullUserById($visitor->getUserId());
      }
    }
    restore_error_handler();
    restore_exception_handler();
    Looks like there are numerous conflicts that I can't resolve.
     
  7. Hardcore

    Hardcore Active Member

    Duh. I don't need that code using the Kotomi add-on. Test page is working just fine.

    So the question is ... using the add-on, how can I gain access to the user's info; user_id, username, is_admin, is_moderator, is_banned, permissions, etc?

    Thanks.
     
  8. Hardcore

    Hardcore Active Member

    Made some progress. Just needed to add ...
    PHP:
    XenForo_Session::startPublicSession();
    $visitor XenForo_Visitor::getInstance();
    if(
    $visitor->getUserId()){
      
    $userModel XenForo_Model::create('XenForo_Model_User');
      
    $userinfo $userModel->getFullUserById($visitor->getUserId());
    }
     
    dwdmadmac likes this.

Share This Page