1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to expose online members data to custom template?

Discussion in 'XenForo Development Discussions' started by Matthew Hawley, Feb 18, 2014.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    Could someone give me a tutorial on how to expose online members and members count data to a custom template? I'm pretty sure it has something to do with viewparams...

  2. Aayush

    Aayush Well-Known Member

    There is a table called xf_session which logs the sessions of users online currently.Use that table to join with users and grabs the data about members you require.
  3. Aayush

    Aayush Well-Known Member

    Also check out the Xenforo Model called Session in the default xf lib. There are a few functions which may help you.
  4. Nobita.Kun

    Nobita.Kun Well-Known Member

    Look at on XenForo_ControllerPublic_Forum at line:41
    'onlineUsers' => $this->_getSessionActivityList(),
    And this function:
    protected function _getSessionActivityList()
    $visitor XenForo_Visitor::getInstance();

    /** @var $sessionModel XenForo_Model_Session */
    $sessionModel $this->getModelFromCache('XenForo_Model_Session');

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

    I think its useful for you :)
  5. Matthew Hawley

    Matthew Hawley Well-Known Member

    Doesn't really help me...I don't know what to do with that.
  6. Aayush

    Aayush Well-Known Member

    What exactly do you want to do?

Share This Page