Changeset 2089733
- Timestamp:
- 05/17/2019 09:13:05 AM (7 years ago)
- Location:
- add-on-contact-form-7-mailpoet
- Files:
-
- 4 edited
- 11 copied
-
tags/1.3.9 (copied) (copied from add-on-contact-form-7-mailpoet/trunk)
-
tags/1.3.9/add-on-contact-form-7-mailpoet.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/add-on-contact-form-7-mailpoet.php)
-
tags/1.3.9/changelog.txt (copied) (copied from add-on-contact-form-7-mailpoet/trunk/changelog.txt)
-
tags/1.3.9/includes/class-mailpoet-cf7-consent.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-consent.php)
-
tags/1.3.9/includes/class-mailpoet-cf7-integration.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-integration.php)
-
tags/1.3.9/includes/class-mailpoet-cf7-submit-form.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-submit-form.php)
-
tags/1.3.9/includes/class-mailpoet-cf7-unsubscribe.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-unsubscribe.php)
-
tags/1.3.9/index.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/index.php)
-
tags/1.3.9/languages/add-on-contact-form-7-mailpoet.pot (copied) (copied from add-on-contact-form-7-mailpoet/trunk/languages/add-on-contact-form-7-mailpoet.pot)
-
tags/1.3.9/languages/how-to-translate.txt (copied) (copied from add-on-contact-form-7-mailpoet/trunk/languages/how-to-translate.txt)
-
tags/1.3.9/readme.txt (copied) (copied from add-on-contact-form-7-mailpoet/trunk/readme.txt)
-
trunk/add-on-contact-form-7-mailpoet.php (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/class-mailpoet-cf7-submit-form.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
add-on-contact-form-7-mailpoet/trunk/add-on-contact-form-7-mailpoet.php
r2086501 r2089733 3 3 * Plugin Name: Add-on Contact Form 7 - Mailpoet 3 4 4 * Description: Add a MailPoet 3 signup field to your Contact Form 7 forms. 5 * Version: 1.3. 95 * Version: 1.3.10 6 6 * Author: Tikweb 7 7 * Author URI: http://www.tikweb.dk/ … … 153 153 */ 154 154 require_once MCFI_ROOT_PATH . 'includes/class-mailpoet-cf7-unsubscribe.php'; 155 156 /** 157 * Mailpoet custom field 158 */ 159 require_once MCFI_ROOT_PATH . 'includes/class-mailpoet-cf7-custom-field.php'; 160 161 -
add-on-contact-form-7-mailpoet/trunk/changelog.txt
r2086501 r2089733 1 1 == Changelog == 2 3 = 1.3.10 – 2019-05-17 = 4 * Added the ability to add mailpoet custom field in contact form 7 2 5 3 6 = 1.3.9 – 2019-05-07 = -
add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-submit-form.php
r2086501 r2089733 17 17 use MailPoet\Models\Subscriber; 18 18 use MailPoet\Subscribers\ConfirmationEmailMailer; 19 19 use MailPoet\Models\CustomField; #get all custom field info without value 20 20 21 21 if ( ! class_exists( 'MailPoet_CF7_Submit_Form' ) ) { … … 29 29 return $_this_class; 30 30 } 31 32 31 33 32 /** … … 79 78 */ 80 79 public function add_email_list( $form_data, $form_tags ) { 80 81 81 // Get field name to get form value 82 82 $field_names = $this->get_email_and_list_name( $form_tags ); … … 110 110 } elseif ( isset( $form_data['your-firstname'] ) ) { 111 111 $firstname = trim( $form_data['your-firstname'] ); 112 } elseif ( isset( $form_data['firstname'] ) ) {112 } elseif ( isset( $form_data['firstname'] ) ) { 113 113 $firstname = trim( $form_data['firstname'] ); 114 } 115 116 else { 114 } else { 117 115 $firstname = ''; 118 116 } … … 126 124 } elseif ( isset( $form_data['lastname'] ) ) { 127 125 $lastname = trim( $form_data['lastname'] ); 128 } 129 130 else { 126 } else { 131 127 $lastname = ''; 132 128 } 133 134 135 129 136 130 //Save all list … … 171 165 } 172 166 167 168 #Get custom fields and fields type 169 $fields = CustomField::findMany(); 170 $results = array(); 171 $results_type = array(); 172 foreach ( $fields as $field ) { 173 $results[ 'cf_' . $field->id ] = $field->name; 174 $results_type[ 'cf_' . $field->id ] = $field->type; 175 } 176 177 173 178 if ( ! empty( $list_ids ) && is_array( $list_ids ) ) { 174 179 $subscribe_data = array( … … 177 182 'first_name' => $firstname, 178 183 'last_name' => $lastname, 179 'status' => 'unconfirmed' 184 'status' => 'unconfirmed', 180 185 ); 186 187 #If custom field presents, append the fields value to subscribe data 188 if ( ! empty( $results ) ) { 189 foreach ( $results as $key => $value ) { 190 foreach ( $results_type as $key_type => $value_type ) { 191 if ( $value_type == 'radio' ) { 192 $subscribe_data[ $key_type ] = $form_data[ $key_type ][0]; 193 } elseif ( $value_type == 'checkbox' && ! ( empty( $form_data[ $key_type ][0] ) ) ) { 194 $subscribe_data[ $key_type ] = 1; 195 } elseif ( $value_type == 'checkbox' && ( empty( $form_data[ $key_type ][0] ) ) ) { 196 $subscribe_data[ $key_type ] = 0; 197 } else { 198 $subscribe_data[ $key ] = $form_data[ $key ]; 199 } 200 } 201 } 202 } 181 203 182 204 //Save subcriber data -
add-on-contact-form-7-mailpoet/trunk/readme.txt
r2086501 r2089733 4 4 Donate link: http://www.tikweb.dk/donate/ 5 5 Requires at least: 4.6 6 Tested up to: 5. 1.16 Tested up to: 5.2 7 7 Requires PHP: 5.2 8 Stable tag: 1.3. 98 Stable tag: 1.3.10 9 9 10 10 Add a MailPoet 3 signup field to your Contact Form 7 forms.
Note: See TracChangeset
for help on using the changeset viewer.