Resource icon

XenForo Connector 1.0

No permission to download
Okay I don't know whether I am stupid or not really understanding this.

Where abouts do we put the connector code - do we make a new php file and include it somewhere?
All I am attempting to do is like many others get the last couple of forum posts and display them on the front page of my php coded website.

Look up poor mans portal here......
I used it on the front page here - http://www.hearth.com
the author will customize and install it for you if you like...
 
thanks the only issue i have now is that it comes up headers already sent and no matter what I attempt it doesn't seem to go away.
 
Okay I don't know whether I am stupid or not really understanding this.

Where abouts do we put the connector code - do we make a new php file and include it somewhere?
All I am attempting to do is like many others get the last couple of forum posts and display them on the front page of my php coded website.
Put the code (includes) before echoing anything else. You can't put it in the middle of the page.
Then do the last posts stuff where you want it to show.
 
if i want to test it in my local host is this correct
<?php
define('XF_ROOT', 'localhost/Forum/'); // 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();
?>

<?php
$threadModel = XenForo_Model::create('XenForo_Model_Thread');
$thread = $threadModel->getThreadById(8); // thread info (associative array)

echo XenForo_Link::buildPublicLink('canonical:threads', $thread); // thread URL
echo XenForo_Link::buildPublicLink('canonical:threads/add-reply', $thread); // add reply URL
?>
 
ok it work now but how can i make it print them

<?php
define('XF_ROOT', 'C:/wamp/www/Forum'); // 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();
?>

<?php
$userinfo['user_id'] and $userinfo['username']

?>
 
Hello, I have that:

/index.php
/forums/ *HERE MY XENFORO INSTALLATION*


My /index.php :

PHP:
<?php
 
define('XF_ROOT', '/forums'); // 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();
 
?>

And I have an error:

1qd1s


Can you help me please ? :)
 
Hi Zephyr,

Is /forums your absolute path or your relative path ? Because it must be absolute (eg: /home/account/www/forums and not simply /forums).
 
Hi, possible to use Zend library (eg: Gdata) with xenforo connector script please ?
 
Hiya, I'm using the script on the Description tab and also using $userinfo['username'] however when I try to echo out the $userinfo['username'] I am getting the following error:

"Notice: Undefined variable: userinfo"
anyone know why?
Thanks
 
Top Bottom