Skip to content

Commit 859e55f

Browse files
committed
gpui-sequential-ids-as-per-date-field.php: Added snippet to generate Unique IDs as per selected date field.
1 parent c25f0e2 commit 859e55f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gp-unique-id/gpui-sequential-ids-as-per-date-field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
* generate Unique IDs for a particular date.
88
*/
99
// Update "123" to your form ID and "4" to your Unique ID field.
10-
add_filter( 'gpui_unique_id_attributes_123_4', 'gw_generate_unique_id_as_per_date_field', 10, 4);
10+
add_filter( 'gpui_unique_id_attributes_123_4', 'gw_generate_unique_id_as_per_date_field', 10, 4 );
1111
function gw_generate_unique_id_as_per_date_field( $atts, $form_id, $field_id, $entry ) {
1212
// Replace 5 with the Date field ID used for targetting Unique ID generation
1313
$date_field_id = 5;
1414

1515
// Remove any special character like / - . which can be in the date field value.
16-
$date_string = str_replace( array( '/', '-', '.' ), '', $entry[$date_field_id] );
16+
$date_string = str_replace( array( '/', '-', '.' ), '', $entry[ $date_field_id ] );
1717

1818
// Update UID Attributes with the date string.
1919
$atts['form_id'] = (int) $date_string;

0 commit comments

Comments
 (0)