WPCF7_ContactForm::submit()publicCF7 1.0

Submits this contact form.

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

Хуки из метода

Возвращает

Массив. Result of submission.

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

$WPCF7_ContactForm = new WPCF7_ContactForm();
$WPCF7_ContactForm->submit( $options );
$options(строка|массив)
Submission options.
По умолчанию: ''

Код WPCF7_ContactForm::submit() CF7 6.0.1

public function submit( $options = '' ) {
	$options = wp_parse_args( $options, array(
		'skip_mail' =>
			( $this->in_demo_mode()
			|| $this->is_true( 'skip_mail' )
			|| ! empty( $this->skip_mail ) ),
	) );

	if ( $this->is_true( 'subscribers_only' )
	and ! current_user_can( 'wpcf7_submit', $this->id() ) ) {
		$result = array(
			'contact_form_id' => $this->id(),
			'status' => 'error',
			'message' => __(
				"This contact form is available only for logged in users.",
				'contact-form-7'
			),
		);

		return $result;
	}

	$submission = WPCF7_Submission::get_instance( $this, array(
		'skip_mail' => $options['skip_mail'],
	) );

	$result = array(
		'contact_form_id' => $this->id(),
	);

	$result += $submission->get_result();

	if ( $this->in_demo_mode() ) {
		$result['demo_mode'] = true;
	}

	do_action( 'wpcf7_submit', $this, $result );

	return $result;
}