WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#19966 closed defect (bug) (invalid)

Comment in the 1 level depth makes comment_reply_link() produce nothing

Reported by: egorpromo Owned by: egorpromo
Milestone: Priority: normal
Severity: normal Version: 3.3.1
Component: Comments Keywords: close
Focuses: Cc:

Description

I use Walker_Comment class to create my comment list.

class indysiteru_walker_comment extends Walker_Comment
{
	function start_lvl(&$output, $depth, $args)
	{

	}
	
	function end_lvl(&$output, $depth, $args)
	{

	}

	function start_el(&$output, $comment, $depth, $args)
	{

$args=array(
'depth' => $depth,
'max_depth' => $args['max_depth'],
'reply_text' => 'reply',
'login_text' => 'login to reply' );
comment_reply_link( $args );

	}

	function end_el(&$output, $comment, $depth, $args)
	{

	}
} 

Parameter $depth is 0 (zero int) when first comment is output. So as you can see http://core.trac.wordpress.org/browser/tags/3.1.1/wp-includes/comment-template.php#L1044 and definition of get_comment_reply_link() within it there is zero check in 1044 line

if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )
return;

Because that my comment_reply_link() function produces nothing when wordpress ouputs comments of first level depth

Change History (4)

comment:1 egorpromo2 years ago

  • Owner set to egorpromo
  • Status changed from new to accepted

comment:2 qdinar2 years ago

this my comment here was wrong: "i wanted to report a bug and found this. i wanted to say if i move comment form with js, i cannot move it [back] to main level. (can move only under other comments, but not under post). ( comment-reply.js is used to move form )"

it is possible with "cancel" button.

Last edited 2 years ago by qdinar (previous) (diff)

comment:3 solarissmoke2 years ago

  • Keywords close added; needs-testing reporter-feedback removed

That's how it's supposed to be. The depth should be set to 1 for top-level comments. In the Comment_Walker class the depth argument is bumped at the beginning of each loop - you should be doing the same in your custom class.

comment:4 SergeyBiryukov2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.