Opened 14 years ago
Closed 10 years ago
#16430 closed defect (bug) (fixed)
Comment 'Reply' button still present when comment max depth has been reached, just without text.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.0.4 |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
With comment max depth set, in my case, to 5 on the admin panel, the div for the reply link would still appear even though the text that says 'Reply' would not. Basically, it was an empty div with class="reply". The fix is quite easy, which I implemented in test on one of my WP sites.
Around line 1372 of wp-includes/comment-template.php, there is the following is code:
<div class="reply"> <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div>
This can simply be enhanced to this:
<?php if ( $depth < $args['max_depth'] ) : ?> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> <?php endif; ?>
I just added a quick check to make sure our current comment depth did not meet (or somehow exceed?) our set max depth.
Attachments (1)
Change History (9)
#2
in reply to:
↑ 1
@
14 years ago
Replying to scribu:
An opposite view: #14540
I can see that, but I would argue that if we wanted the user to keep on posting comments in reply to other comments we wouldn't limit the depth in the first place. I would also think that it would be confusing for other users to read and figure out if a comment was meant for the comment immediately above it OR if it was in replay to the comment it is nested in.
Either way, the 'Reply' text wasn't present for me, just a small, empty box (<div class="reply"></div>) where the text would have been were more comments allowed. The comment_reply_link() function returns nothing when max depth is reached it seems, not even the text for the link. Doing what is suggested in your link would be fine, but I think it would be something users should be able to allow or disallow, making it an entirely separate concept and code change. In short... I agree with the dissenters on that ticket ;)
#3
@
14 years ago
Yeah, maybe "opposite" wasn't the right word. Bottom line is that this should be fixed, one way or the other.
#4
@
14 years ago
I could've sworn that I saw a 'before' and 'after' variables that could be set in get_comment_reply_link, which is called by comment_reply_link.
Perhaps possible to remove the depth evaluation and simply move the opening and closing div's to be placed before and after when it returns true.
http://core.trac.wordpress.org/browser/tags/3.1.1/wp-includes/comment-template.php
#5
@
12 years ago
@travelvice is absolutely right, the markup can be passed to the function in which case it only displays if it returns. I've created and tested a patch that covers the default function and the implementations in the core themes.
An opposite view: #14540