Amount of topics started by user below avatar (IP.Board 3.1.x)

29 Jul 2011, 12:58

If we want to show amount of topics started by user below the number of posts in view topic there was written amount of started topics by user, follow the following steps.


Open: admin/applications/forums/modules_public/forums/topics.php


Find (in function public function parsePostRow( $row = array() )):


//-----------------------------------------
// Add it to the cached list
//-----------------------------------------
$this->cached_members[ $row['author_id'] ] = $poster;


Add above:


$this->DB->build( array(
'select' => 'COUNT(*) as topics',
'from' => 'topics',
'where' => 'starter_id=' . $row['author_id'],
) );

$this->DB->execute();
$r = $this->DB->fetch();

$poster['topics'] = $r['topics'];


Go to ACP -> Look & Feal -> skin -> Templates -> Global Templates -> userInfoPane


Find:


<li>
<span class='ft'>{$this->lang->words['m_posts']}</span>
<span class='fc'>{parse expression="$this->registry->getClass('class_localization')->formatNumber( intval( $author['posts'] ) )"}</span>
</li>


Add below:



<li>
<span class='ft'>Topics:</span>
<span class='fc'><a href='{parse url="app=core&amp;module=search&amp;do=user_posts&amp;mid={$author['member_id']}&amp;search_filter_app[forums]=1&amp;view_by_title=1" base="public"}'>{parse expression="$this->registry->getClass('class_localization')->formatNumber( intval( $author['topics'] ) )"}</a></span>
</li>


Save and finish.


Article category: IP.Board