WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 4 years ago

#7092 reopened enhancement

Should support separate setting for limiting comments feed

Reported by: redsweater Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Feeds Keywords: has-patch
Focuses: Cc:

Description

Right now the comments feeds are throttled by the same limiting number the user chooses for "posts feeds" (posts_per_rss).

It makes sense that a blog owner would want to set a higher threshold for comments than for posts, for these reasons:

  • Readers who subscribe to comment feeds are fewer in number and less likely to burden the system in aggregate.
  • Comments are typically shorter per entry than posts are.
  • Comments are liable to expand much more quickly than posts, making it difficult for readers to "keep up" without wrapping past the limit.

For instance in my blog I limit post feeds to 10 entries, but I'd like to offer a much larger limit for comments subscribers.

Establishing a "comments_per_feed" variable that is used in place of the "posts_per_rss" would accomplish this.

Attachments (2)

hakre-commentsfeedlength-7092.php (2.6 KB) - added by hakre 4 years ago.
Have fun / v0.1.2
7092.diff (6.5 KB) - added by nacin 4 years ago.

Download all attachments as: .zip

Change History (27)

comment:1 ryan6 years ago

  • Milestone changed from 2.7 to 2.8

comment:2 FFEMTcJ5 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.8 to Future Release

comment:3 Denis-de-Bernardy5 years ago

  • Component changed from General to Feeds
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

plugin material

comment:4 redsweater5 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I'm reopening this unless a more substantial explanation for closing it is provided. "plugin material" doesn't mean much to me, and doesn't serve as a valuable record of the dismissal process.

Thanks for considering keeping this as a legitimate enhancement request. I think it would benefit the project to eventually adopt the changes I recommended.

If the shorthand used in closing this bug was representative of a more thoughtful elimination process, I think it would serve the project to append the actual reasons for dismissing and closing this bug.

Thanks!
Daniel

comment:5 Denis-de-Bernardy5 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

As a rule of thumb, the UI mindset is less options = better. The best options without asking the user = best.

This would add new options. There already are two options related to this, which should probably be dropped instead.

There are a few plugins that let you change the number of posts based on the type of archive. One could be used for inspiration to make one that changes the number of comments in feeds.

comment:6 Denis-de-Bernardy5 years ago

Just read your comment in the wordpress-dev chat log. I'll do my best to immediately be more verbose next time. :-)

comment:7 lapcat4 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Please reconsider implementing this. I've hacked my own WordPress blog to fix it, but the problem keeps hitting me when I subscribe to the comments feeds of other people's blogs, and they don't even realize there's a problem. If you have a 'hot' post where there are a lot of comments, you miss a bunch of them in the feed, because most people have their setting at the default 10.

This is not plugin material. The basic functionality of WordPress in this area is broken. It's a very frequent occurrence that a new post gets 20-30 comments in a day or two, but it's a much less frequent occurrence that there are 20-30 posts in a day or two, so the two feeds should have differenent settings.

If you don't want to have a new option in the user interface, then just change the default for the comments feed to something higher, like 50 or 100.

comment:8 scribu4 years ago

lapcat, could you demonstrate how you hacked your WordPress, possibly in the form of a patch?

comment:9 lapcat4 years ago

scribu, here's the little hack I did in wp-includes/query.php:

-				$climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'));
+				$climits = apply_filters('comment_feed_limits', 'LIMIT 100');

-			$climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'));
+			$climits = apply_filters('comment_feed_limits', 'LIMIT 100');

comment:10 dd324 years ago

  • Keywords dev-feedback added
  • Milestone set to Future Release
  • Version set to 2.9

Just setting this to a Future release pending developer feedback..

As for that hack, you can replace it with a single line in your themes functions.php file:

add_filter('comment_feed_limits', create_function('$a', 'return "LIMIT 100";'));

comment:11 hakre4 years ago

I think this report is very valid, good point. Even though it's simple to hack (as most stuff is), I would like to see this in because it really makes sense.

comment:12 hakre4 years ago

As it is now common sense that this is plugin material I added a plugin for reference and to show how easy this is to implement. Save the file in your plugin folder and activate the commentsfeedlength plugin. Then visit Settings -> Reading and you'll find the setting at the end of the reading options default section. Just enter the value you see fit.

I suggest to close as invalid since this really is plugin material.

comment:13 hakre4 years ago

  • Keywords needs-patch dev-feedback removed

hakre4 years ago

Have fun / v0.1.2

comment:14 hakre4 years ago

Related: #7682

comment:15 follow-up: redsweater4 years ago

What makes it "common sense" that this is plugin material?

Should the setting for controlling how many posts are in the RSS Feed be eliminated and moved to a plugin?

Please provide us with a little more information about your decision - the common sense you allude to is not self-evident. My best interpretation of what you are saying is that because it is possible to implement the feature as a plugin, that is necessarily where it should be done.

I would tend to agree with lapcat's assessment above: "The basic functionality of WordPress in this area is broken." Generally speaking, fundamentally broken things should be fixed in the product, not in a plugin.

comment:16 in reply to: ↑ 15 hakre4 years ago

  • Keywords needs-patch added

Replying to redsweater:

...

You do not need to use the plugin. Feel free to provide a patch for the core so that it can be reviewed.

comment:17 redsweater4 years ago

I reported this bug as a user of WordPress. I probably will not get around to creating a patch for it, in case that affects the willingness of the WordPress team to keep the bug open.

comment:18 hakre4 years ago

Can you actually provide some feedback if you use the provided plugin it does the job? Just asking, no actual need for you to use it generally just to find out if that code does what your intention is.

comment:19 nacin4 years ago

I may just patch this, that way a dev can do a thumbs up or down on it once and for all.

comment:20 nacin4 years ago

  • Keywords has-patch added; needs-patch removed

We already have posts_per_page, comments_per_page, posts_per_rss. Patch (untested) adds comments_per_rss. As much as we hate options in core, I think it does make sense and easily fits into the options-reading UI.

I chose for it to follow the footsteps of posts_per_rss, instead of comments_per_page -- it currently relies on posts_per_rss anyway.

It would default to whatever posts_per_rss is.

nacin4 years ago

comment:21 follow-up: redsweater4 years ago

Hi nacin - I installed and tested your patch and it seems to do what I was requesting. Thank you!

One question: I notice you added something to schema.php that appears to incorporate the posts_per_rss as the default value for comments_per_rss. When does this get applied? Is this something that will get automatically set up when a database upgrade occurs?

I noticed after installing the patch that when I went to the Reading preferences, the value was blank. So I want to make that there is a plan to have a default value applied when the feature reaches real end-users.

comment:22 in reply to: ↑ 21 nacin4 years ago

Replying to redsweater:

Hi nacin - I installed and tested your patch and it seems to do what I was requesting. Thank you!

One question: I notice you added something to schema.php that appears to incorporate the posts_per_rss as the default value for comments_per_rss. When does this get applied? Is this something that will get automatically set up when a database upgrade occurs?

If this gets committed, the core dev making the commit will bump the $wp_db_version global in wp-includes/version.php to the latest revision number. This will force a database upgrade which will run the schema and add the new option.

To test this, delete the comments_per_rss option from your options table, then increase the $wp_db_version global by 1. On load, you'll get an "upgrade required" screen and the default value should be applied.

comment:23 nacin4 years ago

(In [13823]) Syndication feeds show the (#) most recent 'items', not posts, as it applies to comments as well. See #12556, see #7092

comment:24 ruijt4 years ago

  • Cc ruijt added
  • Type changed from enhancement to defect (bug)

Hi nacin... Exactly what I needed...

The only thing is an error on the admin/reading page:

Warning: Missing argument 1 for commentsfeedlengthPlugin::settings_field_input_callback() in /home/admin/domains/*/public_html/site/wp-content/plugins/hakre-commentsfeedlength-7092.php on line 101

Warning: extract() [function.extract]: First argument should be an array in /home/admin/domains/*/public_html/site/wp-content/plugins/hakre-commentsfeedlength-7092.php on line 102

Can you help me with this?

Regards, Bas

comment:25 nacin4 years ago

  • Type changed from defect (bug) to enhancement

hakre can probably answer questions offlist about his plugin. hakre.wordpress.com.

Note: See TracTickets for help on using tickets.