wpcf7_acceptance_filter()CF7 1.0

Хуков нет.

Возвращает

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

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

wpcf7_acceptance_filter( $accepted, $submission );
$accepted(обязательный)
.
$submission(обязательный)
.

Код wpcf7_acceptance_filter() CF7 6.1.4

function wpcf7_acceptance_filter( $accepted, $submission ) {
	$tags = wpcf7_scan_form_tags( array( 'type' => 'acceptance' ) );

	foreach ( $tags as $tag ) {
		if ( empty( $tag->name ) ) {
			continue;
		}

		$value = wpcf7_superglobal_post( $tag->name ) ? 1 : 0;

		$content = empty( $tag->content )
			? (string) reset( $tag->values )
			: $tag->content;

		$content = trim( $content );

		if ( $value and $content ) {
			$submission->add_consent( $tag->name, $content );
		}

		if ( $tag->has_option( 'optional' ) ) {
			continue;
		}

		$invert = $tag->has_option( 'invert' );

		if (
			$invert and $value or
			! $invert and ! $value
		) {
			$accepted = false;
		}
	}

	return $accepted;
}