Gravity_Forms_Helpers::get_batch_by_value( $code_field,  $entry )

Get the batch object by code value.


Parameters Parameters

$code_field

(Required) The code field entry inside Gravity forms object.

$entry

(Required) The GF entry passed from gform_after_submission action hook.


Top ↑

Return Return

(object) The batch.


Source Source

File: src/integrations/gravity-forms/helpers/gravity-forms-helpers.php

	public static function get_batch_by_value( $code_field, $entry ) {

		global $wpdb;

		return $wpdb->get_row(
			$wpdb->prepare(
				"SELECT * FROM {$wpdb->prefix}uncanny_codes_codes as tbl_codes
				INNER JOIN {$wpdb->prefix}uncanny_codes_groups as tbl_batch
				WHERE tbl_codes.code_group = tbl_batch.ID
				AND tbl_codes.code = %s",
				$entry[ $code_field->id ]
			)
		);
	}