Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The feed icon is currently displayed for all nodes where the comment setting is open or closed, but not hidden. I believe that the icon should only be displayed when the commetns are open.
RSS-feeds are intended to allow a user to keep track of changes. If the comments are closed (but still visible) then there will not be any update to the feed. Presenting an RSS-feed in this situation gives the user the expectation that the feed will have updates.
Proposed resolution
Change the function commentrss_node_feed_access to block access unless the comments are open. In commentrss.module, starting from line 95:
/**
* Access callback; determines if the user can access a node's comment RSS.
*/
function commentrss_node_feed_access($node, $check_view_access = TRUE) {
// Old line:
// return $node->comment != COMMENT_NODE_HIDDEN && variable_get('commentrss_node', TRUE) && user_access('access comments') && (!$check_view_access || node_access('view', $node));
// Replaced by new line:
return $node->comment == COMMENT_NODE_OPEN && variable_get('commentrss_node', TRUE) && user_access('access comments') && (!$check_view_access || node_access('view', $node));
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 2-commentrss-hide_icon_if_comments_are_closed-1508096.patch | 828 bytes | nbouhid |
Comments
Comment #1
Dave ReidI don't think we should change the access function since this will make the feed result in a 403 even when comments are visible. I would support not showing the feed icon on the node but still making the feed itself available.
Comment #2
nbouhid CreditAttribution: nbouhid as a volunteer and at CI&T commentedPatch based on Dave Reid suggestions.
Comment #3
erickbj CreditAttribution: erickbj at CI&T commentedI applied the patch against 7.x-2.x and confirmed both cases (behavior before and after patch). Patch works fine.
Comment #5
larruda CreditAttribution: larruda at CI&T commented