classes/PodsAPI.php
public function save_comment_meta( $id, $comment_meta = null, $strict = false, $fields = array() ) {

		$simple_tableless_objects = PodsForm::simple_tableless_objects();

		$conflicted = pods_no_conflict_check( 'comment' );

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

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

		$id = (int) $id;

		$meta = get_comment_meta( $id );

		foreach ( $comment_meta as $meta_key => $meta_value ) {
			if ( null === $meta_value ) {
				$old_meta_value = '';

				if ( isset( $meta[ $meta_key ] ) ) {
					$old_meta_value = $meta[ $meta_key ];
				}

				delete_comment_meta( $id, $meta_key, $old_meta_value );
			} else {
				$simple = false;

				if ( isset( $fields[ $meta_key ] ) ) {
					$field_data = $fields[ $meta_key ];

					$simple = ( 'pick' === $field_data['type'] && in_array( pods_var( 'pick_object', $field_data ), $simple_tableless_objects ) );
				}

				if ( $simple ) {
					delete_comment_meta( $id, $meta_key );

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

					foreach ( $meta_value as $value ) {
						add_comment_meta( $id, $meta_key, $value );
					}
				} else {
					update_comment_meta( $id, $meta_key, $meta_value );
				}
			}
		}

		if ( $strict ) {
			foreach ( $meta as $meta_key => $meta_value ) {
				if ( ! isset( $comment_meta[ $meta_key ] ) ) {
					delete_comment_meta( (int) $id, $meta_key, $comment_meta[ $meta_key ] );
				}
			}
		}

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

		return $id;
	}
public function save_comment_meta( $id, $comment_meta = null, $strict = false, $fields = array() ) {

		$simple_tableless_objects = PodsForm::simple_tableless_objects();

		$conflicted = pods_no_conflict_check( 'comment' );

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

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

		$id = (int) $id;

		$meta = get_comment_meta( $id );

		foreach ( $comment_meta as $meta_key => $meta_value ) {
			if ( null === $meta_value ) {
				$old_meta_value = '';

				if ( isset( $meta[ $meta_key ] ) ) {
					$old_meta_value = $meta[ $meta_key ];
				}

				delete_comment_meta( $id, $meta_key, $old_meta_value );
			} else {
				$simple = false;

				if ( isset( $fields[ $meta_key ] ) ) {
					$field_data = $fields[ $meta_key ];

					$simple = ( 'pick' === $field_data['type'] && in_array( pods_var( 'pick_object', $field_data ), $simple_tableless_objects ) );
				}

				if ( $simple ) {
					delete_comment_meta( $id, $meta_key );

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

					foreach ( $meta_value as $value ) {
						add_comment_meta( $id, $meta_key, $value );
					}
				} else {
					update_comment_meta( $id, $meta_key, $meta_value );
				}
			}
		}

		if ( $strict ) {
			foreach ( $meta as $meta_key => $meta_value ) {
				if ( ! isset( $comment_meta[ $meta_key ] ) ) {
					delete_comment_meta( (int) $id, $meta_key, $comment_meta[ $meta_key ] );
				}
			}
		}

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

		return $id;
	}
public function save_comment_meta ( $ id , $ comment_meta = null , $ strict = false , $ fields = array ( ) ) { $ simple_tableless_objects = PodsForm :: simple_tableless_objects ( ) ; $ conflicted = pods_no_conflict_check ( 'comment' ) ; if ( ! $ conflicted ) { pods_no_conflict_on ( 'comment' ) ; } if ( ! is_array ( $ comment_meta ) ) { $ comment_meta = array ( ) ; } $ id = ( int ) $ id ; $ meta = get_comment_meta ( $ id ) ; foreach ( $ comment_meta as $ meta_key => $ meta_value ) { if ( null === $ meta_value ) { $ old_meta_value = '' ; if ( isset ( $ meta [ $ meta_key ] ) ) { $ old_meta_value = $ meta [ $ meta_key ] ; } delete_comment_meta ( $ id , $ meta_key , $ old_meta_value ) ; } else { $ simple = false ; if ( isset ( $ fields [ $ meta_key ] ) ) { $ field_data = $ fields [ $ meta_key ] ; $ simple = ( 'pick' === $ field_data [ 'type' ] && in_array ( pods_var ( 'pick_object' , $ field_data ) , $ simple_tableless_objects ) ) ; } if ( $ simple ) { delete_comment_meta ( $ id , $ meta_key ) ; if ( ! is_array ( $ meta_value ) ) { $ meta_value = array ( $ meta_value ) ; } foreach ( $ meta_value as $ value ) { add_comment_meta ( $ id , $ meta_key , $ value ) ; } } else { update_comment_meta ( $ id , $ meta_key , $ meta_value ) ; } } } if ( $ strict ) { foreach ( $ meta as $ meta_key => $ meta_value ) { if ( ! isset ( $ comment_meta [ $ meta_key ] ) ) { delete_comment_meta ( ( int ) $ id , $ meta_key , $ comment_meta [ $ meta_key ] ) ; } } } if ( ! $ conflicted ) { pods_no_conflict_off ( 'comment' ) ; } return $ id ; }
Save a comment meta

@param int   $id           Comment ID
@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 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 meta