• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[Products] XenFans.com - Header Statistics Thingy

  • Thread starter Thread starter Floris
  • Start date Start date
Status
Not open for further replies.
A possible solution to the data not being available on other pages is probably something like this; included in the ControllerPublic/Stats.php file in a class / public function actionIndex()

Code:
$visitor = XenForo_Visitor::getInstance();
$sessionModel = $this->getModelFromCache('XenForo_Model_Session');

$onlineUsers = $sessionModel->getSessionActivityQuickList(
	$visitor->toArray(),
	array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),
	($visitor['user_id'] ? $visitor->toArray() : null)
);

$boardTotals = $this->getModelFromCache('XenForo_Model_DataRegistry')->get('boardTotals');
if (!$boardTotals)
	$boardTotals = $this->getModelFromCache('XenForo_Model_Counters')->rebuildBoardTotalsCounter();
	$viewParams = array(
	'onlineUsers' => $onlineUsers,
	'boardTotals' => $boardTotals
);

I've used this in my extrapage-add-on.
 
Small hint:

Instead of running
PHP:
$visitor = XenForo_Visitor::getInstance(); $sessionModel = $this->getModelFromCache('XenForo_Model_Session');  $onlineUsers = $sessionModel->getSessionActivityQuickList(    $visitor->toArray(),    array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),    ($visitor['user_id'] ? $visitor->toArray() : null) );  $boardTotals = $this->getModelFromCache('XenForo_Model_DataRegistry')->get('boardTotals'); if (!$boardTotals)    $boardTotals = $this->getModelFromCache('XenForo_Model_Counters')->rebuildBoardTotalsCounter();    $viewParams = array(    'onlineUsers' => $onlineUsers,    'boardTotals' => $boardTotals );
on all pages, i've made it this way for a similar add-on:

1. create an cronjob which is executing this stuff:
PHP:
$visitor = XenForo_Visitor::getInstance(); $sessionModel = $this->getModelFromCache('XenForo_Model_Session');  $onlineUsers = $sessionModel->getSessionActivityQuickList(    $visitor->toArray(),    array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),    ($visitor['user_id'] ? $visitor->toArray() : null) );  $boardTotals = $this->getModelFromCache('XenForo_Model_DataRegistry')->get('boardTotals'); if (!$boardTotals)    $boardTotals = $this->getModelFromCache('XenForo_Model_Counters')->rebuildBoardTotalsCounter();    $viewParams = array(    'onlineUsers' => $onlineUsers,    'boardTotals' => $boardTotals );
(so it's also possible to grab many more infos (or another way is to put the necessary queries into
rebuildBoardTotalsCounter()
Once you grabed all necessary infos, store them into the xf cache.

And the add-on gets the data from the cache (what's IMO better & quicker, specially if you read also several other data from the database)
 
What does styling have to do with anything? It's a div with a class, nothing else.
It's just an example plugin to show the user that wanted something how it can be done.
How they use this is up to them. Styling has nothing to do with this little thingy.
 
How do I get it working on all pages too? This is exactly what I wanted and the styling isnt too important, I wanted to style it myself :) Thanks a lot!
 
ohh.. then it should be moved to Development Tutorials and Resources :p
No, it's a release, it just isn't styled to YOUR particular liking. You don't know what future releases might include that doesn't just help this individual and others - but even more people with more features / settings (and/or styling). Who knows, it might have modules for Oni's Blog, Jaxel's portal, someone's shopping cart, or a visual switcher that let's the end user decide between plain text, a styled block, and/or it's location.

The size of the .php / .xml or feature list doesn't categorize it or distinguish it from documentation vs a release.

Point me to the sticky thread in this forum where it says what guidelines there are and policies that make a released product an add-on .. Stop your nonsense please you're polluting the release thread.. Don't like it, move on. Thanks for the feedback though. I just wish you could communicate it in a more mature manner rather than with your current attitude.
 
I like this, I think I'm going to use it, oh btw to whoever us concerned about styling, its easy enough to just edit it to your own liking.
 
Minus the lacking class importantMessage, this appears to be working on 1.1.0 beta 1.
 
The .zip hasn't been updated, and does exactly what it originally did. No, not all pages.
 
Future, yes. Timeline: Unknown. I want to, but need the free time, and because of my visual handicap I can only do my hobbies a few hours tops per day.
 
Future, yes. Timeline: Unknown. I want to, but need the free time, and because of my visual handicap I can only do my hobbies a few hours tops per day.
Thanks Floris, good to know it will be included some time when you can, I wasn't aware of your handicap there :(
 
Thanks Floris, good to know it will be included some time when you can, I wasn't aware of your handicap there :(
No worries, was just explaining that unfortn. it means I have to pick my coding battles hehe.
 
Status
Not open for further replies.
Top Bottom