classes/PodsAPI.php
public function save_comment( $comment_data, $comment_meta = null, $strict = false, $sanitized = false, $fields = array() ) {

		if ( ! is_array( $comment_data ) || empty( $comment_data ) ) {
			return pods_error( __( 'Comment data is required but is either invalid or empty', 'pods' ), $this );
		}

		$conflicted = pods_no_conflict_check( 'comment' );

		if ( ! $conflicted ) {
			pods_no_conflict_on( 'comment' );
		}

		if ( ! is_array( $comment_meta ) ) {
			$comment_meta = array();
		}

		if ( $sanitized ) {
			$comment_data = pods_unsanitize( $comment_data );
			$comment_meta = pods_unsanitize( $comment_meta );
		}

		if ( ! isset( $comment_data['comment_ID'] ) || empty( $comment_data['comment_ID'] ) ) {
			$comment_data['comment_ID'] = wp_insert_comment( pods_slash( $comment_data ) );
		} elseif ( 1 < count( $comment_data ) ) {
			// Expects slashed
			wp_update_comment( $comment_data );
		}

		if ( is_wp_error( $comment_data['comment_ID'] ) ) {
			if ( ! $conflicted ) {
				pods_no_conflict_off( 'comment' );
			}

			/**
			 * @var $comment_error WP_Error
			 */
			$comment_error = $comment_data['comment_ID'];

			return pods_error( $comment_error->get_error_message(), $this );
		}

		$this->save_comment_meta( $comment_data['comment_ID'], $comment_meta, $strict, $fields );

		if ( ! $conflicted ) {
			pods_no_conflict_off( 'comment' );
		}

		return $comment_data['comment_ID'];
	}
public function save_comment( $comment_data, $comment_meta = null, $strict = false, $sanitized = false, $fields = array() ) {

		if ( ! is_array( $comment_data ) || empty( $comment_data ) ) {
			return pods_error( __( 'Comment data is required but is either invalid or empty', 'pods' ), $this );
		}

		$conflicted = pods_no_conflict_check( 'comment' );

		if ( ! $conflicted ) {
			pods_no_conflict_on( 'comment' );
		}

		if ( ! is_array( $comment_meta ) ) {
			$comment_meta = array();
		}

		if ( $sanitized ) {
			$comment_data = pods_unsanitize( $comment_data );
			$comment_meta = pods_unsanitize( $comment_meta );
		}

		if ( ! isset( $comment_data['comment_ID'] ) || empty( $comment_data['comment_ID'] ) ) {
			$comment_data['comment_ID'] = wp_insert_comment( pods_slash( $comment_data ) );
		} elseif ( 1 < count( $comment_data ) ) {
			// Expects slashed
			wp_update_comment( $comment_data );
		}

		if ( is_wp_error( $comment_data['comment_ID'] ) ) {
			if ( ! $conflicted ) {
				pods_no_conflict_off( 'comment' );
			}

			/**
			 * @var $comment_error WP_Error
			 */
			$comment_error = $comment_data['comment_ID'];

			return pods_error( $comment_error->get_error_message(), $this );
		}

		$this->save_comment_meta( $comment_data['comment_ID'], $comment_meta, $strict, $fields );

		if ( ! $conflicted ) {
			pods_no_conflict_off( 'comment' );
		}

		return $comment_data['comment_ID'];
	}
public function save_comment ( $ comment_data , $ comment_meta = null , $ strict = false , $ sanitized = false , $ fields = array ( ) ) { if ( ! is_array ( $ comment_data ) || empty ( $ comment_data ) ) { return pods_error ( __ ( 'Comment data is required but is either invalid or empty' , 'pods' ) , $ this ) ; } $ conflicted = pods_no_conflict_check ( 'comment' ) ; if ( ! $ conflicted ) { pods_no_conflict_on ( 'comment' ) ; } if ( ! is_array ( $ comment_meta ) ) { $ comment_meta = array ( ) ; } if ( $ sanitized ) { $ comment_data = pods_unsanitize ( $ comment_data ) ; $ comment_meta = pods_unsanitize ( $ comment_meta ) ; } if ( ! isset ( $ comment_data [ 'comment_ID' ] ) || empty ( $ comment_data [ 'comment_ID' ] ) ) { $ comment_data [ 'comment_ID' ] = wp_insert_comment ( pods_slash ( $ comment_data ) ) ; } elseif ( 1 < count ( $ comment_data ) ) { // Expects slashed wp_update_comment ( $ comment_data ) ; } if ( is_wp_error ( $ comment_data [ 'comment_ID' ] ) ) { if ( ! $ conflicted ) { pods_no_conflict_off ( 'comment' ) ; } /**
			 * @var $comment_error WP_Error
			 */ $ comment_error = $ comment_data [ 'comment_ID' ] ; return pods_error ( $ comment_error -> get_error_message ( ) , $ this ) ; } $ this -> save_comment_meta ( $ comment_data [ 'comment_ID' ] , $ comment_meta , $ strict , $ fields ) ; if ( ! $ conflicted ) { pods_no_conflict_off ( 'comment' ) ; } return $ comment_data [ 'comment_ID' ] ; }
Save a comment and it's meta

@param array $comment_data All comment data to be saved (using wp_insert_comment / wp_update_comment)
@param array $comment_meta (optional) All meta to be saved (set value to null to delete)
@param bool  $strict       (optional) Whether to delete previously saved meta not in $comment_meta
@param bool  $sanitized    (optional) Will unsanitize the data, should be passed if the data is sanitized before
sending.
@param array $fields       (optional) The array of fields and their options, for further processing with

@return int Comment ID

@since 2.0.0
Save a comment and it s meta