C CiaranT Member Dec 29, 2014 #1 Hi, In the "notable members" view, each member has number of messages, number of likes, number of trophy points. How does one add "time last online" to the above list. Thanks.
Hi, In the "notable members" view, each member has number of messages, number of likes, number of trophy points. How does one add "time last online" to the above list. Thanks.
S Syndol Guest Dec 29, 2014 #2 You would have to edit one PHP function (_getNotableMembers) and one template (member_list_item) Upvote 0 Downvote
C CiaranT Member Dec 29, 2014 #3 Thanks. What do I need to add into these templates / functions? Upvote 0 Downvote
S Syndol Guest Dec 29, 2014 #4 In function _getNotableMembers() in file XenForo_ControllerPublic_Member you will have to change Code: 'join' => XenForo_Model_User::FETCH_USER_FULL, to Code: 'join' => XenForo_Model_User::FETCH_USER_FULL | XenForo_Model_User::FETCH_LAST_ACTIVITY, and in template member_list_item you will have to add HTML: <xen:if is="{$user.effective_last_activity}"><br /><dt>{xen:phrase last_activity}:</dt> <dd>{xen:datetime $user.effective_last_activity, 'html'}</dd></xen:if> right after HTML: <dt>{xen:phrase trophy_points}:</dt> <dd title="{xen:phrase trophy_points}">{xen:number $user.trophy_points}</dd> Note that to also add the last activity to the "Staff" tab, you will also have to edit function actionIndex() change PHP: if ($type == 'staff') { $users = $userModel->getUsers(array('is_staff' => true), array( 'join' => XenForo_Model_User::FETCH_USER_FULL, 'order' => 'username' )); } to PHP: if ($type == 'staff') { $users = $userModel->getUsers(array('is_staff' => true), array( 'join' => XenForo_Model_User::FETCH_USER_FULL | XenForo_Model_User::FETCH_LAST_ACTIVITY, 'order' => 'username' )); } Upvote 0 Downvote
In function _getNotableMembers() in file XenForo_ControllerPublic_Member you will have to change Code: 'join' => XenForo_Model_User::FETCH_USER_FULL, to Code: 'join' => XenForo_Model_User::FETCH_USER_FULL | XenForo_Model_User::FETCH_LAST_ACTIVITY, and in template member_list_item you will have to add HTML: <xen:if is="{$user.effective_last_activity}"><br /><dt>{xen:phrase last_activity}:</dt> <dd>{xen:datetime $user.effective_last_activity, 'html'}</dd></xen:if> right after HTML: <dt>{xen:phrase trophy_points}:</dt> <dd title="{xen:phrase trophy_points}">{xen:number $user.trophy_points}</dd> Note that to also add the last activity to the "Staff" tab, you will also have to edit function actionIndex() change PHP: if ($type == 'staff') { $users = $userModel->getUsers(array('is_staff' => true), array( 'join' => XenForo_Model_User::FETCH_USER_FULL, 'order' => 'username' )); } to PHP: if ($type == 'staff') { $users = $userModel->getUsers(array('is_staff' => true), array( 'join' => XenForo_Model_User::FETCH_USER_FULL | XenForo_Model_User::FETCH_LAST_ACTIVITY, 'order' => 'username' )); }
S Syndol Guest Dec 29, 2014 #5 You could turn this into an add-on of course, but that would mean adding an extra query in order to fetch the effective last activity for the resulting users. Upvote 0 Downvote
You could turn this into an add-on of course, but that would mean adding an extra query in order to fetch the effective last activity for the resulting users.
C CiaranT Member Dec 29, 2014 #6 Syndol said: In function _getNotableMembers() in file XenForo_ControllerPublic_Member you will have to change Click to expand... Basic question time. I am new to this. How do I go the above? Thanks. Upvote 0 Downvote
Syndol said: In function _getNotableMembers() in file XenForo_ControllerPublic_Member you will have to change Click to expand... Basic question time. I am new to this. How do I go the above? Thanks.
S Syndol Guest Dec 29, 2014 #7 The file would be located in your_installation/library/XenForo/ControllerPublic/Member.php Upvote 0 Downvote