Skip to content

Instantly share code, notes, and snippets.

@webaware
Created December 19, 2012 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webaware/4333741 to your computer and use it in GitHub Desktop.
Save webaware/4333741 to your computer and use it in GitHub Desktop.
filter the eWAY invoice reference for a Gravity Form post
<?php
add_filter('gfeway_invoice_ref', 'my_gfeway_invoice_ref', 10, 2);
/**
* filter the eWAY invoice reference for a Gravity Form post
* @param string $ref the reference before filtering
* @param array $form the Gravity Form object
* @return string
*/
function my_gfeway_invoice_ref($ref, $form) {
// replace 'Membership Number' with the label on your custom field
foreach($form['fields'] as $field) {
if ($field['label'] == 'Membership Number') {
$ref = rgpost('input_' . $field['id']);
break;
}
}
return $ref;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment