#37267 closed defect (bug) (fixed)
Don't output a cancel comment reply link if comments aren't threaded
Reported by: | henry.wright | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Comments | Keywords: | has-patch has-screenshots has-unit-tests commit |
Focuses: | Cc: |
Description
cancel_comment_reply_link()
is used inside comment_form()
to output a cancel comment reply link. If comments aren't threaded, the cancel comment reply link isn't needed. It currently appears in the HTML source regardless of the status of thread_comments
.
Attachments (6)
Change History (26)
#1
@
8 years ago
- Component changed from General to Comments
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 4.5.3 to 2.9
@
8 years ago
@rachelbaker @henry.wright here is a patch to skip rendering cancel comment reply link if comments aren't threaded.
This ticket was mentioned in Slack in #core by jignesh. View the logs.
8 years ago
#4
@
8 years ago
Thanks for the patch. Personally, I'd just bail from the function early if comments aren't threaded.
function get_cancel_comment_reply_link( $text = '' ) { if ( ! get_option( 'thread_comments' ) ) { return ''; } // Rest of code.
#5
@
8 years ago
37267.diff is an alternative to @jignesh.nakrani's patch.
37267.diff won't stop cancel_reply_before
and cancel_reply_before
output, but it will stop the actual cancel comment reply link output.
@
4 years ago
here is a patch to skip rendering cancel comment reply link if comments aren't threaded.
#7
@
4 years ago
- Keywords needs-refresh removed
37267.diff won't stop cancel_reply_before and cancel_reply_before output, but it will stop the actual cancel comment reply link output.
I think if cancel_reply_link
is not being added then we don’t have to print cancel_reply_before
and cancel_reply_after
@henrywright @desrosj
#8
@
3 years ago
- Keywords needs-refresh added
The patch doesn't apply cleanly against trunk anymore. Refreshing and testing right now.
@
3 years ago
Comments: Don’t output the cancel comment link when thread_comments
option is not enabled
@
3 years ago
After patch: the link is not generated at all when threaded_comments option is not enabled
#9
@
3 years ago
- Keywords has-screenshots added; needs-refresh removed
- Milestone changed from Future Release to 5.9
37267.2.diff
refreshes the previous patch against trunk.
It's tested and it work fine: see screenshots above.
Moving for 5.9 consideration.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
#12
@
3 years ago
- Keywords needs-unit-tests added; commit removed
Removing commit keyword as it looks like it needs some unit tests
This ticket was mentioned in Slack in #core by chaion07. View the logs.
3 years ago
This ticket was mentioned in PR #1892 on WordPress/wordpress-develop by hellofromtonya.
3 years ago
#14
- Keywords has-unit-tests added; needs-unit-tests removed
Applies 37267.2.diff patch and adds tests.
Trac ticket: https://core.trac.wordpress.org/ticket/37267
#15
@
3 years ago
- Keywords commit added
37267.2.diff works as expected. PR 1892 adds unit tests to it.
Marking for commit
.
#16
@
3 years ago
- Owner set to hellofromTonya
- Status changed from new to reviewing
Preparing commit.
hellofromtonya commented on PR #1892:
3 years ago
#18
Committed via changeset https://core.trac.wordpress.org/changeset/52175.
@henry.wright Thanks for the report. While
cancel_comment_reply_link()
is always called, if you look at the code inget_cancel_comment_reply_link()
the reply link is still output, but hidden unless thereplytocom
param is set:$style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
If threaded comments aren't allowed, I don't see why we need to output anything. Would you be willing to submit a patch?
Introduced in [12810]