• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • 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
#2
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
#3
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
#5
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
#7
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
#9
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.
 
F

Floris

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

Floris

Guest
#18
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
#19
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 :(
 
Status
Not open for further replies.