Welcome to Our Community

Registration on our forums are now open for some days! Feel free to sign up today.

[Free Add-on ] XenForo Connector 1.0

Integrate XF data on your website

  1. Caldexi
    XenForo Connector
    This is more copy/paste code than a resource, but the forum is being archived and as I'm getting some emails about the old forumConnector, here it is for everyone to find conveniently.

    This is designed to be copied/pasted into a PHP script on your website and requires XenForo to be installed on the same fileserver. If your website and your forums don't use the same subdomain (or more generally if you have cookie issues), be sure to set your
    (in your forums/library/config.php file).
    define('XF_ROOT''/my/path/to/xf'); // set this (absolute path)!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 (!
    $visitor XenForo_Visitor::getInstance();
     if (
    $userModel XenForo_Model::create('XenForo_Model_User');$userinfo $userModel->getFullUserById($visitor->getUserId());
    And here are some useful bits of code ;)

    Get the logout URL
    $visitor XenForo_Visitor::getInstance(); // this could be moved to the "main" code above, right after the $userinfo initialization
    echo XenForo_Link::buildPublicLink("canonical:logout"$userinfo, array('_xfToken' => $visitor['csrf_token_page'], 'redirect' => 'any_url')); //redirect is optional
    Get a thread's info and URL
    $threadModel XenForo_Model::create('XenForo_Model_Thread');$thread $threadModel->getThreadById(ID); // thread info (associative array)
    echo XenForo_Link::buildPublicLink('canonical:threads'$thread); // thread URLecho XenForo_Link::buildPublicLink('canonical:threads/add-reply', $thread); // add reply URL
    sameheg and iMeMo like this.
  • About Us

    Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.
  • Like us on Facebook

  • Buy us a beer!

    The management works very hard to make sure the community is running the best software, best designs, and all the other bells and whistles. Care to buy us a beer? We'd really appreciate it!

    Donate to us!