Created
December 19, 2012 01:56
-
-
Save webaware/4333741 to your computer and use it in GitHub Desktop.
filter the eWAY invoice reference for a Gravity Form post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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