Advertisement
chrishajer

Revised function to apply to multiple forms

Feb 13th, 2013
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/sending-additional-information-to-authorizenet-via-namevalue-pairs#post-146608
  3. add_filter('gform_authorizenet_before_single_payment','my_anet_custom_fields', 10, 2);
  4. function my_anet_custom_fields($transaction, $form_data) {
  5.  
  6.         # GET DATA FROM FORM INPUT BASED ON FORM ID
  7.        # CREATE MULTIPLE FORM to FIELD MAPPINGS HERE
  8.  
  9.         # form 75 uses input_3 for the phone number
  10.        if (rgpost('form_id') == 75 {
  11.                 $form_data["phone"] = rgpost('input_3');
  12.         }
  13.         # form 14 uses input_17 for the phone number
  14.     else if (rgpost('form_id') == 14 {
  15.                 $form_data["phone"] = rgpost('input_17');
  16.         }
  17.  
  18.         # ADD DATA TO TRANSACTION OBJECT
  19.        $transaction->phone = $form_data["phone"];
  20.  
  21.         return $transaction;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement