LPH
Well-known member
I have a WordPress widget that pulls the online users as shown below. This works great and renders the template on the WordPress page or post. The issue is the relative links are being rendered rather than the full board url.
LPH would link to lph/members/lph.1 instead of lph/community/members/lph.1
Since this is outside of the file structure of XenForo - how can I get the full path instead of relative path?
LPH would link to lph/members/lph.1 instead of lph/community/members/lph.1
Since this is outside of the file structure of XenForo - how can I get the full path instead of relative path?
PHP:
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
$sessionModel = XenForo_Model::create( 'XenForo_Model_Session' )->getModelFromCache('XenForo_Model_Session');
$visitor = XenForo_Visitor::getInstance();
$styleId = $visitor['style_id'];
if ( $styleId > 0 ) {
XenForo_Template_Public::setStyleId( $styleId );
} else {
XenForo_Template_Public::setStyleId( 1 );
}
$languageId = $visitor['language_id'];
if ( $languageId > 0 ) {
XenForo_Template_Abstract::setLanguageId( $languageId );
} else {
XenForo_Template_Abstract::setLanguageId( 1 );
}
/** Pull onlineUsers */
$onlineUsers = $sessionModel->getSessionActivityQuickList( $visitor->toArray(), array(
'cutOff' => array(
'>',
$sessionModel->getOnlineStatusTimeout()
)
), ( $visitor['user_id'] ? $visitor->toArray() : null ) );
$userLimit = '';
$page = '';
$userPerPage = '';
$onlineTotals = '';
$params = array(
'onlineUsers' => $onlineUsers,
'visitor' => $visitor,
'userLimit' => $userLimit,
'page' => $page,
'usersPerPage' => $userPerPage,
'onlineTotals' => $onlineTotals
);
$template = $dependencies->createTemplateObject( 'sidebar_online_users', $params );
echo $template->render();