• 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

Status
Not open for further replies.
F

Floris

Guest
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.
 
R

ragtek

Guest
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)
 
F

Floris

Guest
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.
 

Michael

Active member
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!
 
F

Floris

Guest
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.
 

Vicros

Active member
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.
 
F

Floris

Guest
Minus the lacking class importantMessage, this appears to be working on 1.1.0 beta 1.
 
F

Floris

Guest
The .zip hasn't been updated, and does exactly what it originally did. No, not all pages.
 
F

Floris

Guest
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.
 

Michael

Active member
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 :(
 
F

Floris

Guest
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