Integration with Existing Site

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
 
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?
 
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.
 
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.
 
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());
}
 
Top Bottom