Skip to content

Commit

Permalink
Inline Comments: Mark nested inline replies with 'incom' comment type.
Browse files Browse the repository at this point in the history
See related commit 794cd32.

See #1.
  • Loading branch information
r-a-y committed Aug 15, 2015
1 parent b6bc22a commit 26fc64e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions includes/hooks-inline-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,21 @@ function cacsp_ic_modify_selector( $retval ) {
* @return array
*/
function cacsp_ic_change_comment_type( $retval ) {
// if not an Inline Comment, stop now!
// not an Inline Comment
if ( false === isset( $_POST[ 'data_incom' ] ) ) {
return $retval;
// see if there is a comment parent
$comment_parent = isset( $retval['comment_parent'] ) ? absint( $retval['comment_parent'] ) : 0;

// check if comment parent is an inline comment; if not, bail!
if ( ! empty( $comment_parent ) ) {
if ( 'incom' !== get_comment( $comment_parent )->comment_type ) {
return $retval;
}

// no parent, bail!
} else {
return $retval;
}
}

$retval['comment_type'] = 'incom';
Expand Down

0 comments on commit 26fc64e

Please sign in to comment.