Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save phillipwilhelm/eac9f9adcf025d3d3163d1f3ce879a13 to your computer and use it in GitHub Desktop.
Save phillipwilhelm/eac9f9adcf025d3d3163d1f3ce879a13 to your computer and use it in GitHub Desktop.
GP Unique ID // Gravity Perks // Populate Unique ID via Dynamic Population
<?php
/**
* GP Unique ID // Gravity Perks // Populate Unique ID via Dynamic Population
*/
add_filter( 'gform_field_value_uid', function( $value, $field ) {
if( function_exists( 'gp_unique_id' ) ) {
$field[ gp_unique_id()->key( 'length' ) ] = 9;
$value = gp_unique_id()->get_unique( $field->formId, $field );
}
return $value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment