public
Last active

filter the eWAY invoice reference for a Gravity Form post

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?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;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.