Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrenellin/17e7d0e0731af25465f1e399eadba3c3 to your computer and use it in GitHub Desktop.
Save andrenellin/17e7d0e0731af25465f1e399eadba3c3 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Nested Forms // Map Full Child Entry Data via User Registration Add-on
<?php
/**
* Gravity Perks // GP Nested Forms // Map Full Child Entry Data via User Registration Add-on
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_action( 'gform_user_registration_meta_value', function( $value, $meta_key, $meta, $form, $entry, $is_username ) {
if( ! is_callable( 'gp_nested_forms' ) || ! gp_nested_forms()->has_nested_form_field( $form ) ) {
return $value;
}
foreach( $meta as $key => $_value ) {
if( $key != $meta_key ) {
continue;
}
$field = GFAPI::get_field( $form, $_value );
if( ! $field || $field->get_input_type() != 'form' ) {
continue;
}
$_entry = new GPNF_Entry( $entry );
$value = $_entry->get_child_entries( $field->id );
}
return $value;
}, 10, 6 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment