how to get the same but for a different style if guest or member?
<?php
class StyleOverride_Listen
{
public static function listen(XenForo_Controller $controller, $action)
{
$visitor = XenForo_Visitor::getInstance();
// STYLE FOR MEMBERS
if ($visitor['user_id'])
{
$visitor['style_id'] = 3;
}
// STYLE FOR GUESTS
else
{
$visitor['style_id'] = 2;
}
}
}
<?php
class StyleOverride_Listen
{
public static function listen(XenForo_Controller $controller, $action)
{
$visitor = XenForo_Visitor::getInstance();
$headers = $controller->getRequest()->getallheaders(); // No idea how these two lines would go
if(($headers['X-PJAX'] == 'true'))
{
$visitor['style_id'] = 1;
}
else
{
$visitor['style_id'] = 7;
}
}
}
$host = $controller->getRequest()->getServer('HTTP_HOST');
$host = $controller->getRequest()->getServer();
xmlhttp.open("GET", location + ((!/[?&]/.test(location)) ? '?_pjax' : '&_pjax'), true);
//Add headers so things can tell the request is being performed via AJAX.
xmlhttp.setRequestHeader('X-PJAX', 'true'); //PJAX header
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');//Standard AJAX header.
<?php
class StyleOverride_Listen
{
public static function listen(XenForo_Controller $controller, $action)
{
$visitor = XenForo_Visitor::getInstance();
// $host = $controller->getRequest()->getServer('HTTP_HOST');
$host = $controller->getRequest()->getServer('X-PJAX');
// if(($host['X-PJAX'] == 'true'))
if ($host == 'true')
{
$visitor['style_id'] = 9;
}
}
}
<?php
class StyleOverride_Listen
{
public static function listen(XenForo_Controller $controller, $action)
{
$visitor = XenForo_Visitor::getInstance();
$host = $controller->getRequest()->getServer('X-PJAX');
if ($host == 'true')
{
$visitor['style_id'] = 9;
}
}
}
Rich (BB code):<?php class StyleOverride_Listen { public static function listen(XenForo_Controller $controller, $action) { $visitor = XenForo_Visitor::getInstance(); // STYLE FOR MEMBERS if ($visitor['user_id']) { $visitor['style_id'] = 3; } // STYLE FOR GUESTS else { $visitor['style_id'] = 2; } } }
if (!$visitor['user_id'])
{
$visitor['style_id'] = 3;
}
I'd like to use this to have different set of styles available per subforum. Would something like that be possible?
Yes, but it's only one style and it's enforced. I wanted it to limit the style choice. Or just for example basing on the nodes name - change the background and title of forum.
We use essential cookies to make this site work, and optional cookies to enhance your experience.