Changeset 2618947
- Timestamp:
- 10/24/2021 06:58:21 AM (4 years ago)
- Location:
- profiler-donations-gravityforms
- Files:
-
- 11 edited
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-772x250.png (modified) (previous)
-
assets/icon-128x128.png (modified) (previous)
-
assets/icon-256x256.png (modified) (previous)
-
trunk/class-profilercommon.php (modified) (11 diffs)
-
trunk/class-profilerdonate-gfaddon.php (modified) (11 diffs)
-
trunk/class-profilerinteraction-gfaddon.php (modified) (2 diffs)
-
trunk/class-profilerlists-gfaddon.php (modified) (1 diff)
-
trunk/class-profilerpostdonate-gfaddon.php (modified) (5 diffs)
-
trunk/index.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
profiler-donations-gravityforms/trunk/class-profilercommon.php
r2319643 r2618947 14 14 protected $gffield_legacyname = ""; 15 15 protected $supports_custom_fields = false; 16 protected $supports_mailinglists = false; 16 17 17 18 public function init() { 18 19 parent::init(); 20 21 // Stripe - force Customer creation 22 add_filter('gform_stripe_customer_id', array($this, 'stripe_customer_id'), 10, 4); 23 add_action('gform_stripe_customer_after_create', array($this, 'stripe_customer_id_save'), 10, 4); 24 add_filter('gform_stripe_charge_pre_create', array($this, 'stripe_payment_intent'), 10, 5); 19 25 } 20 26 … … 28 34 $hiddenFields = $this->hiddenFields(); 29 35 $checkboxRadioFields = $this->checkboxRadioFields(); 36 $checkboxFields = $this->checkboxFields(); 30 37 $userdefinedfields = $this->userDefinedFields(); 31 $customfields = $this->custom_fields_get();32 38 33 39 $numbers = array(); … … 112 118 } 113 119 120 // Mailing list support 121 if($this->supports_mailinglists === true) { 122 $fields[] = array( 123 "label" => 'Number of Mailing Lists', 124 "type" => "select", 125 "name" => "profiler".$this->gffield_legacyname."_mailinglist_count", 126 "required" => false, 127 "tooltip" => "Select a quantity of Mailing Lists, save this page, and then configure them. You will need to refresh this page after saving to see the extra fields.", 128 "choices" => $numbers, 129 "default" => 0, 130 ); 131 132 for($i = 1; $i <= $feed['meta']['profiler'.$this->gffield_legacyname.'_mailinglist_count']; $i++) { 133 // Loop over mailing list fields 134 135 $fields[] = array( 136 "label" => 'Mailing List #'.$i.': UDF', 137 "type" => "select", 138 "name" => "profiler".$this->gffield_legacyname."_mailinglist_".$i."_udf", 139 "required" => false, 140 "tooltip" => "Pick the Profiler User Defined Field you wish to use for this mailing", 141 "choices" => $userdefinedfields, 142 ); 143 144 $fields[] = array( 145 "label" => 'Mailing List #'.$i.': UDF Text', 146 "type" => "text", 147 "name" => "profiler".$this->gffield_legacyname."_mailinglist_".$i."_udftext", 148 "required" => false, 149 "tooltip" => "Enter the string Profiler is expecting in this UDF", 150 ); 151 152 $fields[] = array( 153 "label" => 'Mailing List #'.$i.': Field', 154 "type" => "select", 155 "name" => "profiler".$this->gffield_legacyname."_mailinglist_".$i."_field", 156 "tooltip" => 'Link it to a checkbox field - when checked, the mailing will be sent', 157 "required" => false, 158 "choices" => $checkboxFields 159 ); 160 } 161 } 162 114 163 if($this->supports_custom_fields === true) { 115 164 $fields[] = array( … … 118 167 "name" => "profiler_customfields_count", 119 168 "required" => false, 120 "tooltip" => "How many custom fields do you want to send back to Profiler? ",169 "tooltip" => "How many custom fields do you want to send back to Profiler? You will need to refresh this page after saving to see the extra fields.", 121 170 "choices" => $numbers, 122 171 ); … … 126 175 127 176 $fields[] = array( 128 "label" => 'Custom Field #'.$i.': Profiler Field',177 "label" => 'Custom Field #'.$i.': UDF', 129 178 "type" => "select", 130 179 "name" => "profiler_customfield_".$i."_pffield", 131 180 "required" => false, 132 "tooltip" => "Pick the field in Profiler you wish to use",133 "choices" => $ customfields,181 "tooltip" => "Pick the UDF field in Profiler you wish to use", 182 "choices" => $userdefinedfields, 134 183 ); 135 184 … … 234 283 } 235 284 236 if($this->apifield_formurl === true && !empty($feed['meta']['profiler_userdefined_clientip'])) { 237 $postData['userdefined' . $feed['meta']['profiler'.$this->gffield_legacyname.'_userdefined_clientip']] = $entry['source_url']; 285 if($this->apifield_formurl === true && !empty($feed['meta']['profiler'.$this->gffield_legacyname.'_userdefined_formurl'])) { 286 $postData['userdefined' . $feed['meta']['profiler'.$this->gffield_legacyname.'_userdefined_formurl']] = $entry['source_url']; 287 } 288 289 if(substr($entry['transaction_id'], 0, 3) == "pi_") { 290 // Stripe Payment - find the Customer ID and Card ID, and pass it to the PF API 291 292 try { 293 if ( ! class_exists( '\Stripe\Stripe' ) ) { 294 require_once( plugin_dir_path( __DIR__ ) . 'gravityformsstripe/includes/autoload.php' ); 295 } 296 297 // Set Stripe API key. 298 $stripe_options = get_option('gravityformsaddon_gravityformsstripe_settings'); 299 \Stripe\Stripe::setApiKey( $stripe_options[$stripe_options['api_mode'] . '_secret_key'] ); 300 301 // Get the Payment Intent 302 $payment_intent = \Stripe\PaymentIntent::retrieve($entry['transaction_id']); 303 304 } catch(Exception $e) { 305 error_log("STRIPE/PROFILER SETUP ERROR: " . print_r($e, true)); 306 } 307 308 if($feed['meta']['profilerdonation_userdefined_gatewaycustomerid'] !== "" && isset($payment_intent)) { 309 // Gateway Customer ID 310 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_gatewaycustomerid']] = $payment_intent->customer; 311 } 312 313 if($feed['meta']['profilerdonation_userdefined_gatewaycardtoken'] !== "" && isset($payment_intent)) { 314 // Gateway Card Token 315 try { 316 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_gatewaycardtoken']] = $payment_intent->charges->data[0]->payment_method; 317 } catch(Exception $e) { 318 error_log("STRIPE/PROFILER CARD TOKEN ERROR: " . print_r($e, true)); 319 } 320 } 238 321 } 239 322 … … 241 324 if($this->supports_custom_fields === true && !empty($feed['meta']['profiler_customfields_count'])) { 242 325 for($i = 1; $i <= $feed['meta']['profiler_customfields_count']; $i++) { 243 $postData["custom_" . $feed['meta']["profiler_customfield_".$i."_pffield"]] = trim($this->get_field_value($form, $entry, $feed['meta']["profiler_customfield_".$i."_gffield"])); 326 $postData["userdefined" . $feed['meta']["profiler_customfield_".$i."_pffield"]] = trim($this->get_field_value($form, $entry, $feed['meta']["profiler_customfield_".$i."_gffield"])); 327 } 328 } 329 330 // Calculate mailing list subscriptions 331 if($this->supports_mailinglists === true && isset($feed['meta']['profiler'.$this->gffield_legacyname.'_mailinglist_count']) && is_numeric($feed['meta']['profiler'.$this->gffield_legacyname.'_mailinglist_count'])) { 332 for($i = 1; $i <= $feed['meta']['profiler'.$this->gffield_legacyname.'_mailinglist_count']; $i++) { 333 // Loop over mailing list fields 334 $mailingFieldValue = $this->get_field_value($form, $entry, $feed['meta']["profiler".$this->gffield_legacyname."_mailinglist_".$i."_field"]); 335 $udf = $feed['meta']["profiler".$this->gffield_legacyname."_mailinglist_".$i."_udf"]; 336 $udfText = $feed['meta']["profiler".$this->gffield_legacyname."_mailinglist_".$i."_udftext"]; 337 338 if(!empty($udf) && !empty($udfText) && !empty($mailingFieldValue)) { 339 $postData['userdefined' . $udf] = $udfText; 340 } 341 244 342 } 245 343 } … … 392 490 } 393 491 492 protected function checkboxFields() { 493 // Returns an array of checkbox fields 494 495 $form = $this->get_current_form(); 496 $fields = $form['fields']; 497 498 // An array holding all the hidden fields on the form - will be returned 499 $formfields = array( 500 array( 501 "value" => "", 502 "label" => "" 503 ) 504 ); 505 506 foreach ($fields as $key => $field) { 507 if ($field['type'] == 'checkbox') { 508 foreach($field['inputs'] as $input) { 509 $formfields[] = array( 510 "value" => $input['id'], 511 "label" => "Field #" . $input['id'] . " - " . $field['label'] . " / " . $input['label'] 512 ); 513 } 514 } 515 } 516 517 return $formfields; 518 } 519 394 520 protected function selectFields() { 395 521 // Returns an array of checkbox and radio fields … … 584 710 $result = parent::save_feed_settings($feed_id, $form_id, $settings); 585 711 586 $this->custom_fields_cache();587 588 712 return $result; 589 590 }591 592 private function custom_fields_cache() {593 // Call this function to update the cached list of custom fields594 595 if($this->supports_custom_fields !== true) {596 return false;597 }598 599 // Data from Profiler is stored in here600 $data = array();601 602 $feed = $this->get_current_feed();603 604 // All the POST data for Profiler gets stored in this variable605 $postData = array();606 607 $postData['DB'] = $feed['meta']['profiler'.$this->gffield_legacyname.'_dbname'];608 $postData[$this->apifield_apikey] = $feed['meta']['profiler'.$this->gffield_legacyname.'_apikey'];609 $postData[$this->apifield_apipass] = $feed['meta']['profiler'.$this->gffield_legacyname.'_apipass'];610 611 if(empty($feed['meta']['profiler'.$this->gffield_legacyname.'_instancedomainname']) && !empty($feed['meta']['profiler'.$this->gffield_legacyname.'_instancename'])) {612 // Respect the setting from when we only accepted the first part of the domain name613 $feed['meta']['profiler'.$this->gffield_legacyname.'_instancedomainname'] = $feed['meta']['profiler'.$this->gffield_legacyname.'_instancename'] . ".profiler.net.au";614 }615 616 if(empty($postData['DB']) || empty($postData[$this->apifield_apikey]) || empty($postData[$this->apifield_apipass]) || empty($feed['meta']['profiler'.$this->gffield_legacyname.'_instancedomainname'])) {617 return false;618 }619 620 // Build the URL for this API call621 $API_URL = "https://" . $feed['meta']['profiler'.$this->gffield_legacyname.'_instancedomainname'] . '/ProfilerAPI/system/customfields/';622 623 // Send request to Profiler624 $pfResponse = $this->sendDataToProfiler($API_URL, $postData, $feed['meta']['profiler_sslmode']);625 626 // Loop over all the returned fields and pop them into the array of data to be saved627 if(isset($pfResponse['dataArray']['field']) && count($pfResponse['dataArray']['field']) > 0) {628 foreach($pfResponse['dataArray']['field'] as $field) {629 $data[] = array(630 'id' => $field['id'],631 'field_name' => $field['field_name'],632 'friendly_name' => $field['friendly_name'],633 'field_category' => $field['field_category'],634 'sortorder' => $field['sortorder'],635 );636 }637 638 // Update the cached data639 update_option('profilergf_'.$this->get_current_feed_id().'_customfields', $data);640 }641 642 }643 644 protected function custom_fields_get() {645 // Returns a list of all custom fields (from the cache)646 647 if($this->supports_custom_fields !== true) {648 return false;649 }650 651 $fields = get_option('profilergf_'.$this->get_current_feed_id().'_customfields', array());652 653 $formfields = array(654 array(655 "value" => "",656 "label" => ""657 )658 );659 660 foreach($fields as $field) {661 $formfields[] = array(662 "value" => $field['id'],663 "label" => $field['field_name'] . ": " . $field['friendly_name'],664 );665 }666 667 return $formfields;668 713 669 714 } … … 774 819 } 775 820 776 p rotectedfunction enable_creditcard($is_enabled) {821 public function enable_creditcard($is_enabled) { 777 822 return true; 778 823 } … … 822 867 } 823 868 869 public function stripe_customer_id($customer_id, $feed, $entry, $form) { 870 // Create a new customer in Stripe 871 872 // Find email address field 873 foreach($form['fields'] as &$field) { 874 if($field->type == "email") { 875 $email = $this->get_field_value($form, $entry, $field->id); 876 } 877 } 878 879 // Find name field on form 880 $name = ''; 881 foreach($form['fields'] as $fieldKey => $field) { 882 if($field->type == "name") { 883 $name = $entry[$field->id . '.3'] . ' ' . $entry[$field->id . '.6']; 884 } 885 } 886 887 if(!isset($email)) { 888 return $customer_id; 889 } 890 891 if(class_exists('\Stripe\Customer')) { 892 // Find an existing customer by email 893 $stripe_all_customers = \Stripe\Customer::all(array( 894 'email' => $email, 895 'limit' => 1 896 )); 897 898 if(isset($stripe_all_customers['data'][0]['id'])) { 899 // Update the name of the customer 900 if(!empty($name)) { 901 $update = \Stripe\Customer::update( 902 $stripe_all_customers['data'][0]['id'], 903 array( 904 'name' => $name 905 ) 906 ); 907 } 908 909 // Return existing customer ID 910 return $stripe_all_customers['data'][0]['id']; 911 } 912 } 913 914 // Create a new customer 915 $customer_meta = array(); 916 $customer_meta['description'] = $email_address . ' ' . $name; 917 $customer_meta['name'] = $name; 918 $customer_meta['email'] = $email_address; 919 920 $customer = gf_stripe()->create_customer($customer_meta, $feed, $entry, $form); 921 return $customer->id; 922 } 923 924 public function stripe_customer_id_save($customer, $feed, $entry, $form) { 925 // Get the new Stripe Customer ID and save for later use 926 gform_update_meta($entry['id'], 'stripe_customer_id', $customer->id); 927 return $customer; 928 } 929 930 public function stripe_payment_intent($charge_meta, $feed, $submission_data, $form, $entry) { 931 $charge_meta['setup_future_usage'] = 'off_session'; 932 return $charge_meta; 933 } 824 934 } 825 935 -
profiler-donations-gravityforms/trunk/class-profilerdonate-gfaddon.php
r2319642 r2618947 16 16 protected $apifield_formurl = true; 17 17 protected $gffield_legacyname = "donation"; 18 protected $supports_custom_fields = true; 19 protected $supports_mailinglists = true; 18 20 19 21 public static function get_instance() { … … 63 65 $checkboxRadioFields = self::$_instance->checkboxRadioFields(); 64 66 $userdefinedfields = self::$_instance->userDefinedFields(); 65 66 $mailingnumbers = array();67 for($i = 0; $i <= 99; $i++) {68 $mailingnumbers[] = array(69 "value" => $i,70 "label" => $i71 );72 }73 67 74 68 // All the fields to add to the feed: … … 137 131 "tooltip" => "This amount field will be used if Donation Type is set to 'regular'.", 138 132 ); 139 133 134 $fields[] = array( 135 "label" => 'UDF: Pledge Type ID', 136 "type" => "select", 137 "name" => "profilerdonation_userdefined_pledgetypeid", 138 "required" => false, 139 "tooltip" => "Pick the Profiler User Defined Field you wish the Pledge Type ID to be sent to", 140 "choices" => $userdefinedfields, 141 ); 142 143 $fields[] = array( 144 "label" => 'Pledge Type ID', 145 "type" => "select", 146 "name" => "profilerdonation_pledgetypeid", 147 "required" => false, 148 "choices" => $field_settings, 149 "tooltip" => "Set this field to the Pledge Type ID" 150 ); 151 152 $fields[] = array( 153 "label" => 'Pledge Type ID (Default)', 154 "type" => "text", 155 "name" => "profilerdonation_pledgetypeid_default", 156 "required" => false, 157 "tooltip" => "Set a default Pledge Type ID, in case the above field isn't set" 158 ); 159 140 160 $fields[] = array( 141 161 "label" => 'Client: Title', … … 450 470 451 471 $fields[] = array( 472 "label" => 'UDF: Client Preferred Contact Method', 473 "type" => "select", 474 "name" => "profilerdonation_userdefined_clientpreferredcontactmethod", 475 "required" => false, 476 "tooltip" => "Pick the Profiler User Defined Field you wish the client's preferred contact method to be sent to", 477 "choices" => $userdefinedfields, 478 ); 479 480 $fields[] = array( 481 "label" => 'Client Preferred Contact Method Field', 482 "type" => "select", 483 "name" => "profilerdonation_clientpreferredcontactmethod", 484 "required" => false, 485 "tooltip" => "This field's value should match one of these codes: E = Email; P = Post; T = Phone; S = SMS; N = No Contact Preferred", 486 "choices" => $field_settings 487 ); 488 489 $fields[] = array( 452 490 "label" => 'UDF: Client IP Address', 453 491 "type" => "select", … … 477 515 478 516 $fields[] = array( 479 "label" => 'Payment Gateway ID Used ',517 "label" => 'Payment Gateway ID Used (Field)', 480 518 "type" => "select", 481 519 "name" => "profilerdonation_paymentgatewayidused", … … 486 524 487 525 $fields[] = array( 488 "label" => 'Number of Mailing Lists', 489 "type" => "select", 490 "name" => "profilerdonation_mailinglist_count", 491 "required" => false, 492 "tooltip" => "Select a quantity of Mailing Lists, save this page, and then configure them. You may need to refresh this page after saving to see the extra fields.", 493 "choices" => $mailingnumbers, 494 "default" => 0, 495 ); 496 497 for($i = 1; $i <= $feed['meta']['profilerdonation_mailinglist_count']; $i++) { 498 // Loop over mailing list fields 499 526 "label" => 'Payment Gateway ID Used (Default)', 527 "type" => "text", 528 "name" => "profilerdonation_paymentgatewayidused_default", 529 "required" => false, 530 "tooltip" => "Specify a default Payment Gateway ID to send through to Profiler", 531 "choices" => $field_settings 532 ); 533 534 if(function_exists('gf_stripe')) { 535 // Stripe only fields 500 536 $fields[] = array( 501 "label" => ' Mailing List #'.$i.': UDF',537 "label" => 'UDF: Payment Gateway Card Token', 502 538 "type" => "select", 503 "name" => "profilerdonation_ mailinglist_".$i."_udf",539 "name" => "profilerdonation_userdefined_gatewaycardtoken", 504 540 "required" => false, 505 "tooltip" => "Pick the Profiler User Defined Field you wish to use for this mailing",541 "tooltip" => "Pick the Profiler User Defined Field you wish to send the payment gateway Card Token to", 506 542 "choices" => $userdefinedfields, 507 543 ); 508 544 509 545 $fields[] = array( 510 "label" => ' Mailing List #'.$i.': UDF Text',511 "type" => " text",512 "name" => "profilerdonation_ mailinglist_".$i."_udftext",546 "label" => 'UDF: Payment Gateway Customer ID', 547 "type" => "select", 548 "name" => "profilerdonation_userdefined_gatewaycustomerid", 513 549 "required" => false, 514 "tooltip" => "Enter the string Profiler is expecting in this UDF", 550 "tooltip" => "Pick the Profiler User Defined Field you wish to send the payment gateway Customer ID to", 551 "choices" => $userdefinedfields, 515 552 ); 516 517 $fields[] = array( 518 "label" => 'Mailing List #'.$i.': Field', 519 "type" => "select", 520 "name" => "profilerdonation_mailinglist_".$i."_field", 521 "tooltip" => 'Link it to a checkbox field - when checked, the mailing will be sent', 522 "required" => false, 523 "choices" => $checkboxFields 524 ); 525 } 526 553 } 527 554 528 555 … … 531 558 } 532 559 533 public function process_feed_custom($feed, $entry, $form, $postData, $fromValidatorProcessPFGateway = false ) {560 public function process_feed_custom($feed, $entry, $form, $postData, $fromValidatorProcessPFGateway = false, $forceSendCard = false) { 534 561 // Processes the feed and prepares to send it to Profiler 535 562 // This can either do a gateway payment, or just an integration … … 591 618 // Payment Gateway ID Used 592 619 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_paymentgatewayidused']] = $this->get_field_value($form, $entry, $feed['meta']['profilerdonation_paymentgatewayidused']); 620 621 if(empty($postData['userdefined' . $feed['meta']['profilerdonation_userdefined_paymentgatewayidused']])) { 622 // Use default value 623 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_paymentgatewayidused']] = $feed['meta']['profilerdonation_paymentgatewayidused_default']; 624 } 593 625 } 594 626 … … 631 663 } 632 664 665 if($feed['meta']['profilerdonation_userdefined_pledgetypeid'] !== "") { 666 // Pledge Type ID 667 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_pledgetypeid']] = $this->get_field_value($form, $entry, $feed['meta']['profilerdonation_pledgetypeid']); 668 669 if(empty($postData['userdefined' . $feed['meta']['profilerdonation_userdefined_pledgetypeid']])) { 670 // Default value if above field is empty 671 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_pledgetypeid']] = $feed['meta']['profilerdonation_pledgetypeid_default']; 672 } 673 } 674 633 675 if($feed['meta']['profilerdonation_userdefined_clientacquisitioncode'] !== "" && $feed['meta']['profilerdonation_clientacquisitioncode'] !== "") { 634 676 // Client Acqusition code … … 652 694 } 653 695 654 // Calculate mailing list subscriptions 655 if(isset($feed['meta']['profilerdonation_mailinglist_count']) && is_numeric($feed['meta']['profilerdonation_mailinglist_count'])) { 656 for($i = 1; $i <= $feed['meta']['profilerdonation_mailinglist_count']; $i++) { 657 // Loop over mailing list fields 658 $mailingFieldValue = $this->get_field_value($form, $entry, $feed['meta']["profilerdonation_mailinglist_".$i."_field"]); 659 $udf = $feed['meta']["profilerdonation_mailinglist_".$i."_udf"]; 660 $udfText = $feed['meta']["profilerdonation_mailinglist_".$i."_udftext"]; 661 662 if(!empty($udf) && !empty($udfText) && !empty($mailingFieldValue)) { 663 $postData['userdefined' . $udf] = $udfText; 664 } 665 666 } 696 if($feed['meta']['profilerdonation_userdefined_clientpreferredcontactmethod'] !== "") { 697 // Client Preferred Contact Method 698 $postData['userdefined' . $feed['meta']['profilerdonation_userdefined_clientpreferredcontactmethod']] = $this->get_field_value($form, $entry, $feed['meta']['profilerdonation_clientpreferredcontactmethod']); 667 699 } 668 700 … … 687 719 } elseif($useAsGateway == false) { 688 720 // Once-off donation (not using Profiler as the gateway) 689 $postData['cardnumber'] = "4444333322221111"; //PF expects a card number and expiry even for once-offs which have already been processed 690 $postData['cardexpiry'] = date("m") . " " . date("Y"); 691 $postData['ccv'] = ""; 721 722 if($forceSendCard == false) { 723 $postData['cardnumber'] = "4444333322221111"; //PF expects a card number and expiry even for once-offs which have already been processed 724 $postData['cardexpiry'] = date("m") . " " . date("Y"); 725 $postData['ccv'] = ""; 726 } 727 692 728 unset($postData['pledgeamount']); 693 729 unset($postData['userdefined' . $feed['meta']['profilerdonation_userdefined_pledgeacquisitioncode']]); -
profiler-donations-gravityforms/trunk/class-profilerinteraction-gfaddon.php
r2319642 r2618947 11 11 12 12 protected $apifield_endpoint = "/ProfilerAPI/interaction/"; 13 protected $apifield_apikey = "api user";13 protected $apifield_apikey = "apikey"; 14 14 protected $apifield_apipass = "apipass"; 15 15 protected $apifield_ipaddress = 'udf'; 16 16 protected $apifield_formurl = true; 17 17 protected $gffield_legacyname = "interaction"; 18 protected $supports_custom_fields = true; 19 protected $supports_mailinglists = true; 18 20 19 21 public static function get_instance() { … … 59 61 ); 60 62 61 $mailingnumbers = array();62 for($i = 0; $i <= 99; $i++) {63 $mailingnumbers[] = array(64 "value" => $i,65 "label" => $i66 );67 }68 69 63 // All the fields to add to the feed: 70 64 $fields = array(); -
profiler-donations-gravityforms/trunk/class-profilerlists-gfaddon.php
r2319643 r2618947 13 13 protected $apifield_apikey = "apikey"; 14 14 protected $apifield_apipass = "apipass"; 15 protected $supports_custom_fields = true; 15 16 16 17 public static function get_instance() { -
profiler-donations-gravityforms/trunk/class-profilerpostdonate-gfaddon.php
r2319642 r2618947 16 16 protected $apifield_formurl = true; 17 17 protected $gffield_legacyname = "donation"; 18 protected $supports_custom_fields = true; 19 protected $supports_mailinglists = true; 18 20 19 21 public static function get_instance() { … … 43 45 $userdefinedfields = self::$_instance->userDefinedFields(); 44 46 45 $mailingnumbers = array();46 for($i = 0; $i <= 99; $i++) {47 $mailingnumbers[] = array(48 "value" => $i,49 "label" => $i50 );51 }52 53 47 // All the fields to add to the feed: 54 48 $fields = array(); … … 72 66 73 67 $fields[] = array( 74 "label" => 'Number of Mailing Lists', 75 "type" => "select", 76 "name" => "profilerdonation_mailinglist_count", 77 "required" => false, 78 "tooltip" => "Select a quantity of Mailing Lists, save this page, and then configure them. You may need to refresh this page after saving to see the extra fields.", 79 "choices" => $mailingnumbers, 80 "default" => 0, 68 "label" => 'Extra Comments Text', 69 "type" => "textarea", 70 "name" => "profilerdonation_commentsextra", 71 "required" => true, 72 "class" => "merge-tag-support", 73 "tooltip" => "This is extra text to be sent to Profiler as an Interaction. Protip: Include Gravity Forms Merge Fields in this textarea to accept user input.", 81 74 ); 82 83 for($i = 1; $i <= $feed['meta']['profilerdonation_mailinglist_count']; $i++) {84 // Loop over mailing list fields85 86 $fields[] = array(87 "label" => 'Mailing List #'.$i.': UDF',88 "type" => "select",89 "name" => "profilerdonation_mailinglist_".$i."_udf",90 "required" => false,91 "tooltip" => "Pick the Profiler User Defined Field you wish to use for this mailing",92 "choices" => $userdefinedfields,93 );94 95 $fields[] = array(96 "label" => 'Mailing List #'.$i.': UDF Text',97 "type" => "text",98 "name" => "profilerdonation_mailinglist_".$i."_udftext",99 "required" => false,100 "tooltip" => "Enter the string Profiler is expecting in this UDF",101 );102 103 $fields[] = array(104 "label" => 'Mailing List #'.$i.': Field',105 "type" => "select",106 "name" => "profilerdonation_mailinglist_".$i."_field",107 "tooltip" => 'Link it to a checkbox field - when checked, the mailing will be sent',108 "required" => false,109 "choices" => $checkboxRadioFields110 );111 }112 75 113 76 $fields[] = array( … … 147 110 $postData['datatype'] = "OLDON"; 148 111 112 $comments = $this->get_field_value($form, $entry, $feed['meta']['profilerdonation_comments']); 113 114 $comments .= GFCommon::replace_variables($feed['meta']['profilerdonation_commentsextra'], $form, $entry, false, true, false, 'text'); 115 $comments = html_entity_decode($comments); 116 149 117 // Only allow ASCII printable characters. 150 118 // This is a work-around to the API endpoint not allowing some characters 151 $comments = preg_replace('/[^\x20-\x7E]/','', $ this->get_field_value($form, $entry, $feed['meta']['profilerdonation_comments']));119 $comments = preg_replace('/[^\x20-\x7E]/','', $comments); 152 120 153 121 // Comments … … 179 147 $postData['HoldingID'] = $pfIntegrationId; 180 148 181 // Calculate mailing list subscriptions182 for($i = 1; $i <= $feed['meta']['profilerdonation_mailinglist_count']; $i++) {183 // Loop over mailing list fields184 $mailingFieldValue = $this->get_field_value($form, $entry, $feed['meta']["profilerdonation_mailinglist_".$i."_field"]);185 $udf = $feed['meta']["profilerdonation_mailinglist_".$i."_udf"];186 $udfText = $feed['meta']["profilerdonation_mailinglist_".$i."_udftext"];187 188 if(!empty($udf) && !empty($udfText) && !empty($mailingFieldValue)) {189 $postData['userdefined' . $udf] = $udfText;190 }191 192 }193 194 149 return $postData; 195 150 } -
profiler-donations-gravityforms/trunk/index.php
r2319642 r2618947 4 4 Plugin URI: http://mediarealm.com.au/ 5 5 Description: Integrates Gravity Forms with Profiler, enabling donation data and more to be sent directly to Profiler. 6 Version: 2. 0.06 Version: 2.1.0 7 7 8 8 Author: Media Realm … … 30 30 class ProfilerDonation_GF_Launch { 31 31 public static function ProfilerDonation_load() { 32 32 33 33 if (!class_exists('GFForms') || !method_exists('GFForms', 'include_payment_addon_framework')) { 34 34 return; … … 57 57 GFAddOn::register('GFProfilerListsBasic'); 58 58 59 require_once('class-profilermembership-gfaddon.php'); 60 GFAddOn::register('GFProfilerMembership'); 61 62 require_once('class-profilerupdate-gfaddon.php'); 63 GFAddOn::register('GFProfilerUpdate'); 64 59 65 //require_once('class-profilerevents-gfaddon.php'); 60 66 //GFAddOn::register('GFProfilerEvents'); 61 67 62 68 // Include some random helper functions 63 require_once('shortcodes.php'); 64 require_once('states_australia.php'); 65 require_once('cardprocess.php'); 69 require_once(plugin_dir_path(__FILE__) . '/shortcodes.php'); 70 require_once(plugin_dir_path(__FILE__) . '/states_australia.php'); 71 require_once(plugin_dir_path(__FILE__) . '/cardprocess.php'); 72 73 // Feature to allow importing user accounts from Profiler 74 require_once(plugin_dir_path(__FILE__) . '/sync_users.php'); 75 76 // Feature to allow importing Organisations from Profiler 77 require_once(plugin_dir_path(__FILE__) . '/sync_orgtype.php'); 66 78 67 79 if(isset($_POST['gform_submit'])) { -
profiler-donations-gravityforms/trunk/readme.txt
r2319642 r2618947 3 3 Tags: gravity-forms, fundraising, crm, donation, profiler 4 4 Requires at least: 5.0 5 Tested up to: 5. 4.15 Tested up to: 5.8.1 6 6 Stable tag: trunk 7 Requires PHP: 7. 0.07 Requires PHP: 7.2.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 22 22 23 23 == Changelog == 24 25 = 2.1.0 = 26 27 * CAUTION: This is a major update. Please take a backup before upgrading, and test your forms thoroughly after performing the update. 28 * New Feature: Import Profiler Subscribers as Wordpress Users 29 * New Feature: Import Organisation to a CPT, in order to create a Directory of organisations 30 * New Feature: Membership Sign-ups & Renewals 31 * New Feature: Update Details for existing Profiler Clients 32 * New Feature: Send Custom Fields to Profiler UDFs in many types of data feeds 33 * New Feature: Stripe Customer & Card compatibility 34 * Various bug fixes and minor changes 24 35 25 36 = 2.0.0 =
Note: See TracChangeset
for help on using the changeset viewer.