For better themeing of the forum list and forum topic list columns, there's a need of giving more information to advf-forum-submitted.tpl.php.

At the moment theming of columns last topic in forum-list and created and last answer/last comment in forum-topic-list is managed via advf-forum-submitted.tpl.php without differentiation.
The only differentiation is made in advanced_forum_preprocess_forum_list AFTER (!) running the .tpl.php

The current order of function calls is

-phptemplate_forum_list
-- template_preprocess_forum_list
--- theme(forum_submitted)
----advf-forum-submitted.tpl.php
-- advanced_forum_preprocess_forum_list
--- (advanced_forum_get_all_last_topics)

Analog order is set for forum_topic_list.

In my perception of theming, the .tpl.php shall be called at the end of the theming procedure. So there has to be some change to function callings. For that reason I changed the order of functions template_preprocess_forum_listadvanced_forum_preprocess_forum_list in phptemplate_forum_list

-phptemplate_forum_list
-- advanced_forum_preprocess_forum_list ( $forum->last_post->more = $last_topics[$tid]; for adding all information!!)
--- (advanced_forum_get_all_last_topics)
-- template_preprocess_forum_list
--- theme(forum_submitted)
----advf-forum-submitted.tpl.php

In advanced_forum_preprocess_forum_list all information of $last_topics is added to the special the $forums->last_post. Now you are able to do more changes in tpl.php, cause of more information.
With adding ..., cs.comment_count .... LEFT JOIN {node_comment_statistics} As cs ... to advanced_forum_get_all_last_topics' query, there's even the opportunity, to create some link to the last post of a thread.

$comments_per_page = _comment_get_display_setting('comments_per_page', $topic); 
$last_pager_page = ceil($topic->more->comment_count / $comments_per_page);
    $title = truncate_utf8($topic->more->nodetitle, variable_get('advforum_last_topic_title_length',15), TRUE, TRUE);
    $link = l($title,"node/" . $topic->more->nid,array('title'=>$topic->more->nodetitle),'page='.$last_pager_page,($topic->more->cid=='cid')?NULL:'comment-'.$topic->more->cid);

Comments

Michelle’s picture

Status: Active » Closed (duplicate)

I'm in the middle of working on this bit of code. See http://drupal.org/node/231376

It already does call the .tpl at the end so there's no need to change the order of the functions around.

Adding a link to the last post in the thread is in the plans.

Michelle