1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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

Discussion in 'Add-on Releases [Archive]' started by Floris, Sep 18, 2011.

Thread Status:
Not open for further replies.
  1. Floris

    Floris Guest

    Removed.
     
    Brandon Sheley and Michael like this.
  2. Floris

    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.
     
    Michael likes this.
  3. ragtek

    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)
     
    Michael, kkm323, Hoffi and 1 other person like this.
  4. kkm323

    kkm323 Well-Known Member

    Good Idea, but Bad Styling :cautious:
     
  5. Floris

    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 likes this.
  6. Michael

    Michael Active Member

    Thanks a bunch Floris, I will be testing this out in a second :)
     
    Floris likes this.
  7. Michael

    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!
     
    Floris likes this.
  8. kkm323

    kkm323 Well-Known Member

    ohh.. then it should be moved to Development Tutorials and Resources :p
     
    Floris likes this.
  9. Floris

    Floris Guest

    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.
     
  10. jmurrayhead

    jmurrayhead Well-Known Member

    Nice work, Floris.
     
    Floris likes this.
  11. Brandon Sheley

    Brandon Sheley Well-Known Member

    Nice work Floris and xenfans, thanks for sharing it with us :)
     
    Floris likes this.
  12. Vicros

    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.
     
    Floris likes this.
  13. Michael

    Michael Active Member

    Any update on this one to get it working on all pages Floris? :)
     
    Floris likes this.
  14. Floris

    Floris Guest

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

    Michael Active Member

    On all pages too?
     
  16. Floris

    Floris Guest

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

    Michael Active Member

    Will you be making it work on all pages in the future?
     
  18. Floris

    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 likes this.
  19. Michael

    Michael Active Member

    Thanks Floris, good to know it will be included some time when you can, I wasn't aware of your handicap there :(
     
    Floris likes this.
  20. Floris

    Floris Guest

    No worries, was just explaining that unfortn. it means I have to pick my coding battles hehe.
     
    Michael likes this.
Thread Status:
Not open for further replies.

Share This Page