Unique Sequences by Nested Forms Parent Entry

Code

Filename: gpuid-sequence-by-nested-forms-parent-entry.php

<?php
/**
 * Gravity Perks // Unique ID // Unique Sequences by Nested Forms Parent Entry
 * https://gravitywiz.com/documentation/gravity-forms-unique-id/
 */
// Update "123" to your child form ID and "4" to your Unique ID field ID.
add_filter( 'gpui_unique_id_attributes_123_4', function ( $atts, $form_id, $field_id ) {

	// Update "5" to the ID of the field on your child form that is capturing the Nested Forms session hash.
	$session_hash = rgpost( 'input_5' );
	if ( empty( $session_hash ) ) {
		return $atts;
	}

	$atts['slug'] = "gpnf-session-hash-{$session_hash}";

	return $atts;
}, 10, 3 );

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.