=> AkismetPlugin::get_user_roles( get_current_user_id() ), 'honypot_field_name' => 'wpforms["hp"]', ]; // phpcs:disable WordPress.Security.NonceVerification.Recommended // If we are on a form preview page, tell Akismet that this is a test submission. if ( isset( $_GET['wpforms_form_preview'] ) ) { $request['is_test'] = true; } // phpcs:enable WordPress.Security.NonceVerification.Recommended $response = AkismetPlugin::http_post( build_query( $request ), 'comment-check' ); return ! empty( $response ) && isset( $response[1] ) && 'true' === trim( $response[1] ); } /** * Validate entry. * * @since 1.7.6 * * @param array $form_data Form data for the current form. * @param array $entry Entry data for the current entry. * * @return string|bool */ public function validate( array $form_data, array $entry ) { // If Akismet is turned on in form settings, is activated, is configured and the entry is spam. if ( ! empty( $form_data['settings']['akismet'] ) && self::is_configured() && $this->entry_is_spam( $form_data, $entry ) ) { // This string is being logged not printed, so it does not need to be translatable. return esc_html__( 'Anti-spam verification failed, please try again later.', 'wpforms-lite' ); } return false; } }