Verifies the request.
Description
By default only the security nonce is checked. Further checks can be applied via a filter.
See also
Parameters
- $data
-
(array) (Required) Submission POST data.
- $form
-
(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Form object.
- $submission
-
(awsmug\Torro_Forms\DB_Objects\Submissions\Submission|null) (Optional) Submission object, or null if a new submission.
Default value: null
Return
(bool|WP_Error) True if request is verified, error object otherwise.
Source
File: src/db-objects/forms/form-frontend-submission-handler.php
protected function verify_request( $data, $form, $submission = null ) { if ( ! isset( $data['nonce'] ) ) { return new WP_Error( 'missing_nonce', __( 'Missing security nonce.', 'torro-forms' ) ); } if ( ! wp_verify_nonce( $data['nonce'], $this->get_nonce_action( $form, $submission ) ) ) { return new WP_Error( 'invalid_nonce', __( 'Invalid security nonce.', 'torro-forms' ) ); } /** * Filters the verification of a form submission request. * * @since 1.0.0 * * @param bool|WP_Error $verified Either a boolean or an error object must be returned. Default true. * @param array $data Submission POST data. * @param Form $form Form object. * @param Submission|null $submission Submission object, or null if a new submission. */ return apply_filters( "{$this->form_manager->get_prefix()}verify_form_submission_request", true, $data, $form, $submission ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |