Forked from spivurno/gp-unique-id-via-dynamic-population.php
Created
September 5, 2016 04:18
-
-
Save phillipwilhelm/eac9f9adcf025d3d3163d1f3ce879a13 to your computer and use it in GitHub Desktop.
GP Unique ID // Gravity Perks // Populate Unique ID via Dynamic Population
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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