MattW
Well-known member
I'm trying to extend this: http://xenforo.com/community/resources/attachment-statistics-admin-home.1654/ so that it displays the number of attachments in the forum statistics section on the forum home.
I can get it to render the text, but I can't seem to get it to display the number
In my listener, I'm extending
but I'm not sure if XenForo_ControllerPublic_Misc is the correct class to extend?
My ControllerPublic then looks the same as my ControllerAdmin file (which works):
I'm still getting my head around all this, so I'm probably missing something really simple?
I can get it to render the text, but I can't seem to get it to display the number
In my listener, I'm extending
PHP:
if ($class == 'XenForo_ControllerPublic_Misc')
{
$extend[] = 'AttachStats_ControllerPublic_AttachStats';
}
My ControllerPublic then looks the same as my ControllerAdmin file (which works):
PHP:
<?php
class AttachStats_ControllerPublic_AttachStats extends XFCP_AttachStats_ControllerPublic_AttachStats
{
public function actionIndex()
{
$parent = parent::actionIndex();
$AttachStatsModel = $this->_getAttachStatsModel();
$attachFiles = $AttachStatsModel->getNumRecords();
$parent->params['attach_files'] = $attachFiles;
return $parent;
}
protected function _getAttachStatsModel()
{
return $this->getModelFromCache('AttachStats_Model_AttachStats');
}
I'm still getting my head around all this, so I'm probably missing something really simple?