ActionScheduler_wpCommentLogger::create_wp_comment │ protected │ WC 1.0

Create comment.

Метод класса: ActionScheduler_wpCommentLogger{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->create_wp_comment( $action_id, $message, $date );
$action_id(int) (обязательный)
Action ID.
$message(строка) (обязательный)
Action log's message.
$date(DateTime) (обязательный)
Action log entry's timestamp.

Код ActionScheduler_wpCommentLogger::create_wp_comment() WC 11.2.2

protected function create_wp_comment( $action_id, $message, DateTime $date ) {

	$comment_date_gmt = $date->format( 'Y-m-d H:i:s' );
	ActionScheduler_TimezoneHelper::set_local_timezone( $date );
	$comment_data = array(
		'comment_post_ID'  => $action_id,
		'comment_date'     => $date->format( 'Y-m-d H:i:s' ),
		'comment_date_gmt' => $comment_date_gmt,
		'comment_author'   => self::AGENT,
		'comment_content'  => $message,
		'comment_agent'    => self::AGENT,
		'comment_type'     => self::TYPE,
	);

	return wp_insert_comment( $comment_data );
}