Needs review
Project:
Commentsblock
Version:
7.x-1.2
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Apr 2012 at 19:17 UTC
Updated:
15 Sep 2013 at 13:33 UTC
Jump to comment: Most recent file
While the paging links display the correct comments do not load when you try to go to a subsequent page in the comments.
Seems like this module needs a lot more testing before being ready for production usage.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1513910-fix-paging-unset-comment_node_view.patch | 1.29 KB | sokrplare |
| #1 | commentsblock-double-call.png | 113.74 KB | sokrplare |
| #1 | commentsblock-double-call-added-element-to-url.png | 113.86 KB | sokrplare |
Comments
Comment #1
sokrplare commentedLooks like this is due to comment_node_page_additions being called twice. Once by the comments module itself as it uses comment_node_view, the second time by commentsblock_block_view.
Now aside from slower processing, this wouldn't be an issue except...
Both functions call comment_node_page_additions, which in turn calls comment_get_thread, which - and this is the key - extends PagerDefault in it's $query object.
PagerDefault lives inside pager.inc and each time it is called, (here is where I'm a little fuzzy, so could be wrong) it registers that caller as a unique paging element on the page. Because it is called twice the pager things the second call is a second element on the page and as a result it never picks up the first element's page URL - since it is looking for a second one!
To confirm this, you can switch the URL from ?page=1 to ?page=0,1 and voila - paging "works"!
I've attached two screenshots showing the elements being picked up and the double-calls. The second time you can see in the URL I've added the second element - and that time it worked to load the second page of comments.
Comment #2
sokrplare commentedThanks to help from http://drupal.stackexchange.com/a/27406/6581 I've got a patch.
I don't think this would break anything comments-wise, but it needs testing by those who choose "Yes" to the configuration option of "Display comment form only?" and use a View to list comments.
Comment #3
sokrplare commentedA quick search just of contrib module we are using for our(large-ish) site turned up uses of hook_module_implementation_alter by:
Not feeling like that commentsblock module is quite on the same playing field as these practically core "contrib" modules.
However, I looked at using the example shown in the API docs for hook_module_implements_alter() which is:
Trouble is, pushing
comment_node_view()to last in the list of executed hooks doesn't help ifhook_node_view()is being called in it's entirety beforehook_block_view()which commentsblock uses.Comment #4
marcoka commentedsaw your other patches, thx for that. i will check them.
is this paging error when using views to display comments or without?
the demo uses views and that seems to work
http://drupal-demo.artwaves.de/comments-block
Comment #5
sokrplare commentedWithout Views (sorry for the late reply).
Comment #6
marcoka commentedso did you find a fix so far?
Comment #7
sokrplare commentedI think the patch in #2 is the fix. We set the comment limit to 300 on our site so that we effectively never have paging.
Comment #8
marcoka commentedok lets wait for some testers that can set it to RTBC
Comment #9
sokrplare commentedWorks for me!
Comment #10
marcoka commentedi am currently not having enough time to commit stuff. if anyone wants to co maintain, tell me.
Comment #11
marcoka commentedsoon the 2.x will come out, with a different approach. It may be fixed there. testing needed.
Comment #12
marcoka commentedcan anyone check/confirm this with the new 2.x?
Comment #13
erlendoos commentedVersion 2 has the same problem... what must I look for to fix it?
Comment #14
erlendoos commentedThe comments block can also be disabled by using display suite. Maybe you should just not want to solve this in your module, but advise to use display suite for hiding the comments section, or in the template?
Comment #15
erlendoos commentedHow about this:
And this:
only... pager not working.... maybe still use a view instead of native comment rendering?
Comment #16
erlendoos commentedSolved, and here is the issue + patch https://drupal.org/node/2089475