Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gurpartap Singh’s picture

Title: Forum module: Link to latest post on forum main page » Link to latest post in 'Last post' in forums table
FileSize
3.48 KB

This is a usability feature, users usually see last update in a forum, but Drupal's forum provides no link to the latest post, making the user go into the forum and look at them. Most of the time it's just easier for the user to directly goto the latest post in any forum.

Patch is simple, but can be improved?

Gurpartap Singh’s picture

Here's a screen shot.

ChrisKennedy’s picture

This is a tricky situation, as it falls into the same problems as #new links don't work across multiple pages. We probably don't want to propagate that bug into a second interface area.

Gurpartap Singh’s picture

Status: Active » Needs review
Gurpartap Singh’s picture

Well, currently we are not linking to latest comment, but the node with latest comment. Btw, already working on that thing.

Gurpartap Singh’s picture

Ok this has the requested feature. Please review that part, if it looks good, maybe it can be put into comment.module as a function(which returns an array -- the third argument for l()) and use wherever necessary.

Gurpartap Singh’s picture

Status: Needs review » Needs work

Page thing needs work.

Gurpartap Singh’s picture

Status: Needs work » Needs review
FileSize
3.48 KB

It seems way to complex requiring lots of code, which should probably be going into comment.module at this issue http://drupal.org/node/6162

So untill that is fixed, we can have link to the node itself, at least.

Gurpartap Singh’s picture

Re-roll. It's a little bit of code to review..

webchick’s picture

This looks like a great usability improvement!

But IMO this code is kind of weird....

+function _forum_format($topic, $show_title = FALSE) {
   if ($topic && !empty($topic->timestamp)) {
-    return t('@time ago<br />by !author', array('@time' => format_interval(time() - $topic->timestamp), '!author' => theme('username', $topic)));
+    if (!$show_title) {
+      return t('@time ago<br />by !author', array('@time' => format_interval(time() - $topic->timestamp), '!author' => theme('username', $topic)));
+    }
+    else {
+      return t('!title<br />@time ago<br />by !author', array('!title' => l(truncate_utf8($topic->node_title, 25, TRUE, TRUE), "node/$topic->nid"),'@time' => format_interval(time() - $topic->timestamp), '!author' => theme('username', $topic)));
+    }

What you're doing is passing in display parameters (and hard-coding HTML) in an API function. What I would recommend doing instead is changing this to a theme function, with core only providing the "show_title" way, and if people want to override that, they can do so in their themes.

Also, +1 to linking to #new. I know #new has problems on pagers, but when that bug finally gets sorted out, we can just fix it in both places, imo. Linking to the node without jumping to the new comment on the 90%+ forum posts that *don't* have multiple pages is a usability detriment, because people might not realize there are new replies unless they're observing closely.

webchick’s picture

Also, why n.title AS node_title ? title is fine. It's more consistent with how this is called elsewhere, and $thread->title is descriptive enough.

Gurpartap Singh’s picture

What I would recommend doing instead is changing this to a theme function, with core only providing the "show_title" way, and if people want to override that, they can do so in their themes.

_forum_format() is a helper function for theme functions in the module. And we want to display titles only on forum's listing. Not on node listing inside a particular forum. So that function is called for both of those listings, and we are setting the argument to send title to true only in one of them(i.e. forum listing page say ?q=forum).

Other than theme function, is there any other suggested/alternate way?

Gurpartap Singh’s picture

Bump

Gurpartap Singh’s picture

Gurpartap Singh’s picture

This time for new forum template files.

merlinofchaos’s picture

I think this needs another reroll.

Gurpartap Singh’s picture

catch’s picture

Status: Needs review » Needs work

So 6162 is fixed, which surely means a re-roll here.
What's the chances of this making it in as a usability improvement in D6? I guess slim, but won't up to 7.x just yet.

catch’s picture

Version: 6.x-dev » 7.x-dev
webchick’s picture

Version: 7.x-dev » 6.x-dev

I don't see any reason to bump to 7.x. This breaks no APIs, and it a usability enhancement.

denney’s picture

Can anyone provide a simple patch for the latest 5.x version?

denney’s picture

Nevermind, patched it myself.

Pancho’s picture

Version: 6.x-dev » 7.x-dev

Moving feature requests to the D7 queue.

Liam McDermott’s picture

SamRose’s picture

@denny (or anyone, really) how exactly were you able to apply this patch to 5.x? 5.x seems to be rejecting everything for me when I try to apply?

Gurpartap Singh’s picture

Status: Needs work » Needs review
FileSize
5.07 KB

Is this approach worth committing? If there's any other, please point direct way to implement :)

zeta ζ’s picture

FileSize
634 bytes

This is my modification of the patched template file;- a little less? complex, and easier to theme.

catch’s picture

This still doesn't deal with the pagin issue (per node/6162). - also this is now in advanced_forum (although there's performance issues with the current implementation) http://drupal.org/node/268273

catch’s picture

Status: Needs review » Needs work
psicomante’s picture

FileSize
2.51 KB

What do you think of phpbb style?

Michelle’s picture

re: #28: The performance issues have now been taken care of. Still might be worth getting this into core, though, as I override a big chunk of core to get it working.

Michelle

Gurpartap Singh’s picture

Status: Needs work » Needs review
FileSize
39.74 KB
5.42 KB
Gurpartap Singh’s picture

Title: Link to latest post in 'Last post' in forums table » Forum: Link to last post in 'Last post' column
Gurpartap Singh’s picture

Issue tags: +Forum

Status: Needs review » Needs work

The last submitted patch failed testing.

Gurpartap Singh’s picture

Status: Needs work » Needs review

Hm, patch applies fine, and passes all tests.

catch’s picture

Gurpartap - did you cvs up?

NaheemSays’s picture

Status: Needs review » Needs work
FileSize
2.54 KB

When trying to apply, hunk 2 failed to apply. attached is the reject file.

Gurpartap Singh’s picture

Status: Needs work » Needs review
FileSize
4.25 KB

yo update

NaheemSays’s picture

tested and it all works, however it is confusing as it does not link to the latest post - just the node with the latest comment. Is this the desired behaviour?

I would have thought it best to jump to the last comment of the node? (maybe the performance cost is too high?)

Gurpartap Singh’s picture

Status: Needs review » Needs work
catch’s picture

Instead of comment_num_new() could do SELECT MAX(cid) then link to the comment/$cid#comment-$cid URLs, shouldn't be any different in terms of performance.

jhodgdon’s picture

This patch should not use truncate_utf8(), especially not with the word-splitting set to TRUE. This will not work for CJK languages. See
http://drupal.org/node/269911#comment-2795478
and #200185: truncate_utf8() is used as a substring function

jhodgdon’s picture

jhodgdon’s picture

The comments in #43 are wrong now -- truncate_utf8() is being fixed up so it can be used for any character set in #768040: truncate_utf8() only works for latin languages (and drupal_substr has a bug).

Oleksa-1’s picture

Instead of comment_num_new() could do SELECT MAX(cid) then link to the comment/$cid#comment-$cid URLs, shouldn't be any different in terms of performance.

it is easy way to implement it in phpbb style
http://drupal.org/files/issues/phpbb_forum_last_thread.jpg

luck777’s picture

this patch is not working on latest drupal 7 build. blank page error at topic-list view.
fix please.

luck777’s picture

Status: Needs work » Needs review
Issue tags: -Forum

#39: d7-forum-last-post.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Forum

The last submitted patch, d7-forum-last-post.patch, failed testing.

crosshairs’s picture

Hi, any updates on the useability of this patch? Seems to be a much requested feature