DONATE NOW TO HELP UPGRADE LIBCOM.ORG

Jump straight to last post...

118 posts / 0 new
Last post
magnifico
Offline
Joined: 29-11-05
Mar 15 2007 21:31

How do you jump straight to last post then, i don't see anything different

Joseph Kay's picture
Joseph Kay
Offline
Joined: 14-03-06
Mar 15 2007 21:33

after you post, it takes you to it. the tracker links aren't working yet it seems

Mike Harman
Offline
Joined: 7-02-06
Mar 15 2007 21:36

Yeah tracker links are a very different thing.

This adjusts the redirect after you post, and allows you to link directly to posts in threads. Without the direct link, it's impossible to get tracker stuff working.

Steven.'s picture
Steven.
Offline
Joined: 27-06-06
Mar 15 2007 21:48

testing

Steven.'s picture
Steven.
Offline
Joined: 27-06-06
Mar 15 2007 21:48

wow! cool

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Mar 15 2007 22:01

x

Mike Harman
Offline
Joined: 7-02-06
Mar 15 2007 22:01

...

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Mar 15 2007 22:08

lol i just like trying it

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 17 2007 23:09

It would be great if you could get this sorted out. Just let me know if you want any help with fixing the jump to the last (new) post links.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 19 2007 22:07

OK, I had a look at this yesterday, and this is what I came up with:

To make the "new" links work on the tracker pages, find the following lines in the tracker.module file (in the function tracker_page)

if ($new = comment_num_new($node->nid)) {
$comments .= 'br />';
$comments .= l(format_plural($new, '1 new', '@count new'), "node/$node->nid", NULL, NULL, 'new');
}

and replace them with the following:

if ($new = comment_num_new($node->nid)) {
$comments_per_page = variable_get('comment_default_per_page', 0);
$pagenum = NULL;
$pageno = $node->comment_count / $comments_per_page;
if ($pageno > 1) $pagenum = "page=" . intval($pageno);
$comments .= 'br />';
$comments .= l(format_plural($new, '1 new', '@count new'), "node/$node->nid", NULL, $pagenum, 'new');
}

To make the "new" links work on the forum pages, find the following lines in the forum.module file (in the function theme_forum_topic_list)

$rows[] = array(
array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
array('data' => $topic->num_comments . ($topic->new_replies ? 'br />'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'),

and replace them with the following:

$comments_per_page = variable_get('comment_default_per_page', 0);
$pagenum = NULL;
$pageno = $topic->num_comments / $comments_per_page;
if ($pageno > 1) $pagenum = "page=" . intval($pageno);
$rows[] = array(
array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
array('data' => $topic->num_comments . ($topic->new_replies ? 'br />'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", NULL, $pagenum, 'new') : ''), 'class' => 'replies'),

This worked for me on a fresh copy of drupal 5.1, so it should work on libcom also. PM me if you have any questions.

Edit: I had to remove the first < in the br /> or else they didn't show up in the text. Remember to put them back if you use the code.

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 12:15

haha that works great!

Thank you very, very much.

I'll try to get this rolled into a patch for drupal.org over the next week or so, see if we can get them to fix it permanently.

Can't believe it's working, going to go click on some "new" links now.... smile

Steven.'s picture
Steven.
Offline
Joined: 27-06-06
Mar 20 2007 12:17
Mike Harman wrote:
haha that works great!

Thank you very, very much.

I'll try to get this rolled into a patch for drupal.org over the next week or so, see if we can get them to fix it permanently.

Can't believe it's working, going to go click on some "new" links now.... :)

doesn't seem to be doing anything for me... in FF portable

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Mar 20 2007 12:25

Nice FF, but i dont think its working. Tried it a couple of times and its not giving me much. Catch did it work for you?

I think this is more than stuff in some .module files, its more to do with stuff in the .tpl.php and anchor links... at least thats what i thought when sorting out the other issue wink

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 12:28

it worked for me on a thread - only time I tried it.

I stuck the forums theme override in template.php - tracker changes I hacked in.

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Mar 20 2007 12:41

I have tried it a bunch of times pretty sure its not working, feedback from anyone else would be cool.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 20 2007 12:42

I assume the reason why drupal hasn't fixed this already, is that they have an option for threaded comments, which makes it more complicated. (Although, you could easily set it up so that it works with flat comments, but still dumps you on page one if you use threaded comments.)

As long as you use flat comments, it's very simple to find the right page: All you have to do is divide the number of comments on a thread with the default numer of comments per page.

Joseph Kay's picture
Joseph Kay
Offline
Joined: 14-03-06
Mar 20 2007 12:47
Felix Frost wrote:
All you have to do is divide the number of comments on a thread with the default numer of comments per page.

which might fix the one bug with the jump-to-comment-after-posting fix - if your new post is on a new page when you use the quick reply, it doesn't find the anchor because it's looking in the previous page. does that make sense catch/rkn?

JDMF's picture
JDMF
Offline
Joined: 21-05-04
Mar 20 2007 12:49

shit, this works for me now! What a fucking relief!

Opera 9.01.

damn, on further note, it takes me to the last message - which is an improvement because it was pissing me off to open a thread, scroll down to numbers, click on last etc.

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 12:50

yeah that might be it, not come across that one though.

Just used the tracker link on this thread, and it took me to the right page, but not the #new anchor (because there were two?) But the right page is pretty good.

The next stage would be to link directly to the most recent post (or first unread post by cid instead of #new), but that's a whole extra thing I think.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 20 2007 13:14

Actually, now it just takes you to the last page, which is wrong when the first new comment is on one of the previous pages, but that should be easy to fix. I'll look into it.

Also right now it seems it is only working on the libcom.org/tracker page but not on libcom.org/forum/tracker or from the individual forum pages. Did you try to change the forum.module file too, or just the tracker.module?

Joseph K. wrote:
which might fix the one bug with the jump-to-comment-after-posting fix - if your new post is on a new page when you use the quick reply, it doesn't find the anchor because it's looking in the previous page. does that make sense catch/rkn?

Should be easy to fix. If you mail me a copy of your comment.module file, I can look at that too if you like.

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 13:33

Because the forum change was at the theme level, I did it in template.php rather than hacking core. I dunno how to do it that way with non-theme functions so the tracker.module was changed in situ. But I think it works the same either way.

The isse with forums/tracker is probably because it's a custom view made with the views module.

Thinking about it - we can take the #new links out of the tracker altogether, it might be possible to make a new "jump to last unread comment" module, expose that to views, and then use that as a field in the tracker lists. And with that also make an extra/override theme function for forum lists.

Wish I knew a bit more than case/switch if/else etc.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 20 2007 15:05
Felix Frost wrote:
Actually, now it just takes you to the last page, which is wrong when the first new comment is on one of the previous pages, but that should be easy to fix. I'll look into it.

Looked at this, and what we need to do is calculate the numer of old comments instead of using the full number of comments.

So in the previous code, in the tracker module, replace the line

$pageno = $node->comment_count / $comments_per_page;

with

$pageno = ($node->comment_count - comment_num_new($node->nid)) / $comments_per_page;

...and in the forum module, replace the line

$pageno = $topic->num_comments / $comments_per_page;

with

$pageno = ($topic->num_comments - $topic->new_replies) / $comments_per_page;

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 20 2007 15:28
Mike Harman wrote:
Because the forum change was at the theme level, I did it in template.php rather than hacking core. I dunno how to do it that way with non-theme functions so the tracker.module was changed in situ. But I think it works the same either way.

I don't know how template.php works, but I would try to make the changes in forum.module since it isn't working now.

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 17:39

ok redone in template.php - write didn't stick last time, plus made those changes (template.php overrides any theme function anywhere else in drupal)

and changed in tracker - see how it goes!

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 17:42

ouch, messed up forums - will have another go.

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 18:16

ok that should be alright.

Mike Harman
Offline
Joined: 7-02-06
Mar 20 2007 19:11

felix - I've rolled your changes into a patch against both Drupal 5.1 and Drupal HEAD in the hope it'll spark some activity on this issue: http://drupal.org/node/6162

Our theme doesn't seem to be producing the #new links properly, but it's going to the last page consistently for me. Can't tell you how much I appreciate the help, it's painful clicking four times as much as necessary just to read one or two posts.

jef costello's picture
jef costello
Offline
Joined: 9-02-06
Mar 21 2007 20:30

From the forums I still end up on the first page of the thread, I don't use the tracker.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Mar 23 2007 11:52
jef costello wrote:
From the forums I still end up on the first page of the thread, I don't use the tracker.

Are you sure? As far as I can tell, the "new" links are now working the way they should on the forum pages. The only place they are not working is on the forums/tracker page, but that is fixable also.

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Mar 23 2007 12:07

FF - yeah its working fine for me from forum index pages, taking me to the right page, but not the right posts.

Interesting how page 5 on the pager shows as page 4 in the address bar. Doesnt matter tho.