Creates Yearly Sequential IDs
Make the sequence for a given Unique ID field specific to the current year. The sequence will automatically reset each year.
Code
Filename: gpuid-yearly-sequential-ids.php
<?php
/**
* GP Unique ID // Gravity Perks // Creates Yearly Sequential IDs
* https://gravitywiz.com/documentation/gravity-forms-unique-id/
*
* Make the sequence for a given Unique ID field specific to the current year. The sequence
* will automatically reset each year.
*/
// Update "123" to your form ID and "4" to your Unique ID field.
add_filter( 'gpui_unique_id_attributes_123_4', function( $atts ) {
$atts['form_id'] = (int) gmdate( 'Y' ) . '0000';
return $atts;
} );
Looks interesting but not sure it would fit my needs… Does this only affect the starting number?
I have Starting Number: 1 Length: 3 Prefix: 456{date_created:format:y} Suffix: empty
Hi Stijn,
Yes, this only affect the starting number, which is the generated unique number. If your use case is different and this won’t work for you, you can submit a ticket via our support form with details on how you want it to work, so we can assist you on how we can get the snippet or a modified version, working for you.
Best,