this patch adds a column to forum display (if the statistics module is enabled) displaying the number of views that each topic got.

Comments

Wesley Tanaka’s picture

Status: Active » Needs review
Wesley Tanaka’s picture

StatusFileSize
new4.56 KB

re-rolled for test2

Thox’s picture

I'm not keen on the way you have changed the arrays ($forum_topic_list_header and $rows). I'd be happier doing something like this:

$forum_topic_list_header = array(
  array('data' => ' '),
  array('data' => t('Topic'), 'field' => 'n.title'),
  array('data' => t('Replies'), 'field' => 'l.comment_count'),
  array('data' => t('Created'), 'field' => 'n.created'),
  array('data' => t('Last reply'), 'field' => 'l.last_comment_timestamp'),
);
if (module_exist('statistics'))
   $forum_topic_list_header[] = array('data' => t('Views'), 'field' => 'nc.totalcount');
$forum_topic_list_header[] = array('data' => t('Last reply'), 'field' => 'l.last_comment_timestamp');

Also, there should be an extra check than simply if the module exists. View counts are optional so you should check that they're on too.

Wesley Tanaka’s picture

I'm confused about the intentions behind your sample code -- it appears to add "Last Reply" twice.

Wesley Tanaka’s picture

StatusFileSize
new4.9 KB

thox clarified the comment here: http://drupal.org/node/40580#comment-60927
on irc.

drumm’s picture

Priority: Critical » Normal

This is not critical.

dries’s picture

Not sure, but we might want to check whether the user is allowed to view the stats. The statistics.module has some permissions that might be relevant.

pwolanin’s picture

Yes, the statistics module has a permission 'view post access counter'. I currently have this off for authenticated users since our site is mostly informational rather than interactive (at the moment- still trying to entice the membership that gets postal mailings and comes to meetings to join into the online community).

beginner’s picture

Status: Needs review » Needs work

Does this mean the patch needs work?

pwolanin’s picture

Yes needs permission checking and probably some updating for HEAD.
Also, it may require more significant reworking of a CCK type replaces the 'forum' type: http://drupal.org/node/62340

liam mcdermott’s picture

Version: x.y.z » 7.x-dev

Bumping version.

Gurpartap Singh’s picture

Status: Needs work » Closed (duplicate)

just enable the statistics module + proper permission to stats access to get the views column.