Skip to content

Instantly share code, notes, and snippets.

@Idealien
Created October 31, 2016 21:56
Show Gist options
  • Save Idealien/519562cc38a724ce50063267f90f14a2 to your computer and use it in GitHub Desktop.
Save Idealien/519562cc38a724ce50063267f90f14a2 to your computer and use it in GitHub Desktop.
WP Gravity Forms CLI - Entry Generation for Workflows
#!/bin/bash
INPUT=input_filename.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read reviewer employee
do
f10=$(wp user get $reviewer --field=ID)
f11=$(wp user get $employee --field=ID)
f14=$(wp user meta get $employee user_meta_field_name)
f15=$(wp user meta get $employee user_meta_field_name)
echo "$reviewer $f10 for $employee - $f11 - $f14 - $f15"
wp gf entry create 66 --field_12=$reviewer --field_13=$employee --field_10="user_id|$f10" --field_11="$f11" --field_14=$f14 --field_15=$f15
done < $INPUT
IFS=$OLDIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment