Jump straight to last post...

118 posts / 0 new
Last post
Mike Harman
Offline
Joined: 7-02-06
Apr 11 2007 17:12

OK, at least I'm not going mad then.

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
May 9 2007 19:27

Bump. For jump to last post icon and some other things there is a list of somewhere but i forgot sad

Mike Harman
Offline
Joined: 7-02-06
May 9 2007 19:51

gettng stuff out of core and into modules/theme we should try, will be hard.

Mike Harman
Offline
Joined: 7-02-06
May 9 2007 19:52

mis-post

Mike Harman
Offline
Joined: 7-02-06
May 20 2007 15:07

Alright, time to collate these together into one uberpost:

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 = _comment_get_display_setting('comments_per_page');
	$pagenum = NULL;
	$pageno = ($node->comment_count - $new) / $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 = _comment_get_display_setting('comments_per_page');
	$pagenum = NULL;
	$pageno = ($topic->num_comments - $topic->new_replies) / $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'),
In the file modules/views/modules/views_comments.inc change the function views_handler_comments_with_new to the following


function views_handler_comments_with_new($fieldinfo, $fielddata, $value, $data) {
  $comments = intval($value);
  if ($comments && $new = comment_num_new($data->nid)) {
    $comments_per_page = _comment_get_display_setting('comments_per_page');
    $pagenum = NULL;
    $pageno = ($node->comment_count - $new) / $comments_per_page;
  if ($pageno >= 1) $pagenum = "page=" . intval($pageno);
    $comments .= '<br />';
    $comments .= l(t('@num new', array('@num' => $new)), "node/$data->nid", NULL, $pagenum, 'new');
    }
    return $comments;
}
Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Jun 8 2007 20:54
rkn wrote:
Quote:
Just tell me what you would like, and I can write the code for you.

Thats great! Thanks so much.... when you are in London we will owe you quite a few drinks wink

Quote:
If you would like a 'jump to the last post' function also, it's fairly easy to do.

Yeah - i think it would be cool to have in the 'last post' column a little jump to last post icon - just like phpBB really.

Quote:
Or what about links to all the pages of comments like I think you used to have before you switched to Drupal?

Under the thread name? Yes that would also be excellent.

Quote:
It might also be nice to put the name of the last poster on the tracker page

Yeah in the last updated column could have 'by...." after the time. It would be cool to have the jump to last post icon there as well.

New links/views module/ forums/tracker - i think catch knows whats going on here, because right now http://libcom.org/forums/tracker is showing not just forum entries but all entries. Likewise with http://libcom.org/forums/tracker/username - it doesnt seem to be working. Will let catch answer on this.

Just reposting for the stuff we still need to work on

Mike Harman
Offline
Joined: 7-02-06
Jun 23 2007 20:07

bump to fix tracker issues.

Tacks's picture
Tacks
Offline
Joined: 8-11-05
Jun 24 2007 18:53

test

Tacks's picture
Tacks
Offline
Joined: 8-11-05
Jun 24 2007 18:53

nope.

Mike Harman
Offline
Joined: 7-02-06
Jun 24 2007 21:39

working for me from tracker - you using main one or forum tracker?

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Aug 3 2007 14:43

So how come the jump to last page when posting comments stopped working?
And what happened with the links to each page of comments that I helped you with some months ago?

On an unrelated subject, splitting threads and moving comments in forums shouldn't be a hard thing to do. Do you know if anyone in the Drupal community is working on this?

Mike Harman
Offline
Joined: 7-02-06
Aug 3 2007 14:59

Hi Felix,

the comment submit thing I took out of comment.module and tried to work into a custom module so it would survive drupal upgrades. Got it to redirect fine - but had to add an extra #submit handler in which meant comments got added twice. I need to get back on that, or just make the changes in the module itself again. Will post up the custom module code later in case you have ideas.

tracker changes rkn did originally and didn't get to putting them back in after a module update - again wanted to put them in a theme function to avoid that happening every time but haven't got to it. Part of this is I've been trying to keep your fixes up to date on http://drupal.org/node/6162 in the hope they'll get into core for the next release.

There's another update to do I think, so will try to re-apply all changes we originally made when I do that - they should last for a while after that.

Thread splitting and moving - the whole issue is drupal stores comments in a hierarchy by default - comments are children of comments instead of the node, so comment_mover.module moves a whole tree of comments in one go.

We have the hierarchy disabled by using flatcomment.module for other reasons - which forces every comment to be a child of the node, but that means comment_mover only does one at a time. We're going to try to help with a complete rewrite of comment.module for Drupal 7 but for now these underlying structural issues mean any solution would be a custom one for us - long term I think it's better to work around stuff like this for now and focus on arguing for/testing/submitting improvements to the project. Having said that if it's really, really easy, and can be done in a module, it'd be an amazing thing to have - since otherwise we're looking at maybe a year or more before there's a solution.

Mike Harman
Offline
Joined: 7-02-06
Aug 19 2007 15:08

Ok so posting comments ought to work now.

The new function is in template.php - just this one hack in comment.module:

function comment_form_submit

change to:

-    return array('node/'. $form_values['nid'], NULL, "comment-$cid");
+  return array('node/'. $form_values['nid'], "page=".comment_last_page($form_values['nid']), "comment-$cid");

find out if it works now I guess!

Mike Harman
Offline
Joined: 7-02-06
Aug 19 2007 15:09

haha it does.

so now it's just pagers on the tracker page. rkn did those I think though, have to find the code.

Mike Harman
Offline
Joined: 7-02-06
Aug 19 2007 16:37

tracker/forum pager links are at:
http://libcom.org/forums/feedback-and-content/pages

most of it's in template.php except for views-node.inc

MJ's picture
MJ
Offline
Joined: 5-01-06
Aug 19 2007 16:40

Ooh I like that.

Mike Harman
Offline
Joined: 7-02-06
Aug 19 2007 16:47

We've had the know how for ages courtesy of felix frost, but have to re-apply the changes every time we upgrade, and were slack last time.

what we should do is roll all of these into a patch against drupal 5.2 with the views module and template.php included - then if/when 5.3 comes out we can just apply the patch. Should work great and only about 20 minutes work to save about 2 hours.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Aug 22 2007 16:39
Mike Harman wrote:
what we should do is roll all of these into a patch against drupal 5.2 with the views module and template.php included - then if/when 5.3 comes out we can just apply the patch. Should work great and only about 20 minutes work to save about 2 hours.

You can also put almost everything in template.php, except a couple lines in tracker.module and a couple other files.

After I post new comments, I get to the right page, but not the right comment. Also, the 'new' links in forums/tracker still doesn't go to the right page.
If you check the views.comments.inc file, here's the right code once more:

function views_handler_comments_with_new($fieldinfo, $fielddata, $value, $data) {
  $comments = intval($value);
  if ($comments && $new = comment_num_new($data->nid)) {
    $comments_per_page = _comment_get_display_setting('comments_per_page');
    $pagenum = NULL;
    $pageno = (intval($value) - $new) / $comments_per_page;
  if ($pageno >= 1) $pagenum = "page=" . intval($pageno);
    $comments .= '<br />';
    $comments .= l(t('@num new', array('@num' => $new)), "node/$data->nid", NULL, $pagenum, 'new');
    }
    return $comments;
}
Mike Harman
Offline
Joined: 7-02-06
Sep 3 2007 08:25

Felix Frost, I love you.

http://drupal.org/cvs?commit=79738

Mike Harman
Offline
Joined: 7-02-06
Sep 3 2007 08:55
Felix Frost wrote:
Mike Harman wrote:
what we should do is roll all of these into a patch against drupal 5.2 with the views module and template.php included - then if/when 5.3 comes out we can just apply the patch. Should work great and only about 20 minutes work to save about 2 hours.

You can also put almost everything in template.php, except a couple lines in tracker.module and a couple other files.

After I post new comments, I get to the right page, but not the right comment.

Can't work that out - it links to the correct anchor, and the anchor is there. Will double check html output make sure there's no extra stray anchors affecting it.

Quote:
Also, the 'new' links in forums/tracker still doesn't go to the right page.
If you check the views.comments.inc file, here's the right code once more:
function views_handler_comments_with_new($fieldinfo, $fielddata, $value, $data) {
  $comments = intval($value);
  if ($comments && $new = comment_num_new($data->nid)) {
    $comments_per_page = _comment_get_display_setting('comments_per_page');
    $pagenum = NULL;
    $pageno = (intval($value) - $new) / $comments_per_page;
  if ($pageno >= 1) $pagenum = "page=" . intval($pageno);
    $comments .= '<br />';
    $comments .= l(t('@num new', array('@num' => $new)), "node/$data->nid", NULL, $pagenum, 'new');
    }
    return $comments;
}

Thanks - will update that.

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Sep 3 2007 14:43
Mike Harman wrote:
Can't work that out - it links to the correct anchor, and the anchor is there. Will double check html output make sure there's no extra stray anchors affecting it.

I would just link to the 'new' anchor instead. That way, if somebody else is posting while you are writing your comment, you won't skip past and miss their posts.

Did you look at the code I wrote for the Private Messages module btw?

Mike Harman
Offline
Joined: 7-02-06
Sep 3 2007 17:51

test

Mike Harman
Offline
Joined: 7-02-06
Sep 3 2007 17:52

comment.module:

function comment_form_submit($form_id, $form_values) {
  $form_values = _comment_form_submit($form_values);
  if ($cid = comment_save($form_values)) {
    return array('node/'. $form_values['nid'], "page=".comment_last_page($form_values['nid']), 'new');
  }
}
Mike Harman
Offline
Joined: 7-02-06
Sep 3 2007 18:05

http://libcom.org/forums/feedback-content/private-messages-12082007

now applied to private message module. We'd updated but it applied with a bit of fuzz.

Tested it and it works - if you've got broken quotes in your private messages the layout will get messed up, but it's definitely good enough for copying to a txt file etc.

Thanks!

And time to bump the private message cull thread!

Mike Harman
Offline
Joined: 7-02-06
Nov 4 2007 16:51

Just to say that thanks to Felix Frost, some other drupal developers, and odd bits of work by me, this is now fixed in Drupal core for the upcoming 6.x version. Redirecting back to your comment after you posted has been fixed as well. Felix, thanks, a lot!

Jacques Roux's picture
Jacques Roux
Offline
Joined: 17-07-06
Nov 22 2007 13:48

That's beautiful news.

Steven.'s picture
Steven.
Offline
Joined: 27-06-06
Nov 23 2007 11:24

damn we rock. thanks felix. (catch i bought him a beer for that btw.)