ActionScheduler_wpCommentLogger::get_logspublicWC 1.0

Get action's logs.

Method of the class: ActionScheduler_wpCommentLogger{}

No Hooks.

Returns

ActionScheduler_LogEntry[].

Usage

$ActionScheduler_wpCommentLogger = new ActionScheduler_wpCommentLogger();
$ActionScheduler_wpCommentLogger->get_logs( $action_id );
$action_id(string) (required)
Action ID.

ActionScheduler_wpCommentLogger::get_logs() code WC 10.9.4

public function get_logs( $action_id ) {
	$status = 'all';
	$logs   = array();

	if ( get_post_status( $action_id ) === 'trash' ) {
		$status = 'post-trashed';
	}

	$comments = get_comments(
		array(
			'post_id' => $action_id,
			'orderby' => 'comment_date_gmt',
			'order'   => 'ASC',
			'type'    => self::TYPE,
			'status'  => $status,
		)
	);

	foreach ( $comments as $c ) {
		$entry = $this->get_entry( $c );

		if ( ! empty( $entry ) ) {
			$logs[] = $entry;
		}
	}

	return $logs;
}