WPCF7_ContactForm::submit()publicCF7 1.0

Submits this contact form.

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

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

Возвращает

Массив. Result of submission.

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

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

Код WPCF7_ContactForm::submit() CF7 5.9.3

public function submit( $args = '' ) {
	$args = wp_parse_args( $args, 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' => $args['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;
}