Skip to content

Instantly share code, notes, and snippets.

@Idealien
Created November 2, 2016 23:54
Show Gist options
  • Save Idealien/8208012c41add2323b5f743e4125a3de to your computer and use it in GitHub Desktop.
Save Idealien/8208012c41add2323b5f743e4125a3de to your computer and use it in GitHub Desktop.
WP Gravity Flow Bulk Creation for Import Plugin Processing
<?php
//replace ## with your form ID - and also update field IDs with your appropriate numbers.
add_action( "gform_pre_submission_##", "employee_lookup_and_assignment", 10, 1 );
function employee_lookup_and_assignment( $form ) {
$reviewer = get_user_by( 'email', rgpost( 'input_12' ));
if( $reviewer ):
$_POST['input_10'] = "user_id|" . $reviewer->ID;
endif;
$employee = get_user_by( 'email', rgpost( 'input_13' ) );
if( $employee ):
$_POST['input_11'] = $employee->ID;
$userMetaExample = get_user_meta($employee->ID, 'user_meta_example', true);
if( $userMetaExample ):
$_POST['input_14'] = $userMetaExample;
endif;
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment