Get Current Sequence Value

Code

Filename: gpuid-get-current-sequence.php

<?php
/**
 * Gravity Perks // Unique ID // Get Current Sequence Value
 * https://gravitywiz.com/documentation/gravity-forms-unique-id/
 */
function gpuid_get_current_sequence( $form_id, $field_id ) {
	global $wpdb;
	return $wpdb->get_var( $wpdb->prepare( "select current from {$wpdb->prefix}gpui_sequence where form_id = %d and field_id = %d", $form_id, $field_id ) );
}

// Update "123" to your form ID and "4" to your Sequential Unique ID field.
$current_sequence = gpuid_get_current_sequence( 123, 4 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.