AnsPress_Comment_Hooks::get_comment()

Description #

Ajax callback to get a single comment.

Source #

File: includes/comments.php

	public static function get_comment() {
		$comment_id = ap_sanitize_unslash( 'comment_id', 'r' );
		$c = get_comment( $comment_id );

		// Check if user can read post.
		if ( ! ap_user_can_read_post( $c->comment_post_ID ) ) {
			wp_die();
		}

		if ( '1' !== $c->comment_approved && ! ( ap_user_can_delete_comment( $c->comment_ID ) || ap_user_can_approve_comment( $c->comment_ID ) ) ) {
			wp_die();
		}

		ap_ajax_json( array(
			'success' => true,
			'comment' => ap_comment_ajax_data( $c, false ),
		) );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment