Opened 8 years ago
Last modified 5 years ago
#38925 new enhancement
Allow override of depth limits on comment reply link
Reported by: | TravisR | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Comments | Keywords: | has-patch dev-feedback has-unit-tests needs-refresh |
Focuses: | Cc: |
Description
The core code currently hides the Reply link if a comment is at the maxDepth setting for comment nesting, but this appears to only be a constraint on the presentation. The API still allows replies through URL parameters and the REST interface, which demonstrates that there is not a functional reason for the constraint.
I'm proposing that plugin authors are allowed to override this constraint by setting $args['limit_by_depth'] = false
in a comment_reply_link_args
filter. This requires only a minor, inconsequential change to comment-template.php per the attached patch.
Note the 'Infinite Comment Replies' plugin currently achieves this by completely rewriting the reply link and thus masking everything that is handled in the core production of the link. The proposal above is a better option to achieve the same effect.
Attachments (2)
Change History (9)
#3
@
7 years ago
- Keywords has-unit-tests added
Thank you for the patch @TravisR
I remember looking into workarounds previously here:
so I was planning to create a ticket for this, when I found this one ;-)
When writing the tests I noticed that the comment validation was missing, so I created another ticket #41846 for that.
The patch in 0001-Support-override-of-depth-constraint-on-reply-link.patch broke the two existing tests in Tests_Comment_GetCommentReplyLink
, because of the missing the comment validation in get_comment_reply_link()
.
I included the comment validation in 38925.2.patch and rearranged it a little bit from the previous patch.
In 38925.2.patch I updated the 0001-Support-override-of-depth-constraint-on-reply-link.patch to the current version, with documentation and few tests.
I'm wondering about the name of the limit_by_depth
argument, if it could better describe it's purpose? Maybe as hide_below_max_depth
, max_depth_hidden
, show_only_above_max_depth
.... But I'm not sure ;-)
#4
@
7 years ago
@birgire,
Thanks for picking this up. I'm not a regular Wordpress contributor so I'm happy to let you run with it, and I don't have any concerns with the updates you've made. As for the variable name, I think 'show_only_above_max_depth' is probably the best of the proposed options. I'll just be happy if you can get this into a release so I don't have to keep modifying the core every time I upgrade.
#5
@
7 years ago
@TravisR
I'm not a core committer, so it's not up to me to add it to the current release ;-)
but by adding tests and inline documentation, we can increase the change.
yes show_only_above_max_depth
describes it nicely, but it's rather long ;-)
You could try to look at my filter example, in one of the links above, to avoid updating the core each time.
#6
@
5 years ago
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to Future Release
Howdy @birgire this patch apparently does not apply cleanly with the core grunt tool. Would you like to give it another go and refresh it? I still believe the change, albeit minor, is good to go.
Thank you!
git patch for the change