Changeset 2103858
- Timestamp:
- 06/11/2019 10:26:35 AM (7 years ago)
- Location:
- add-on-contact-form-7-mailpoet
- Files:
-
- 4 edited
- 12 copied
-
tags/1.3.10 (copied) (copied from add-on-contact-form-7-mailpoet/trunk)
-
tags/1.3.10/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.10/changelog.txt (copied) (copied from add-on-contact-form-7-mailpoet/trunk/changelog.txt)
-
tags/1.3.10/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.10/includes/class-mailpoet-cf7-custom-field.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-custom-field.php)
-
tags/1.3.10/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.10/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.10/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.10/index.php (copied) (copied from add-on-contact-form-7-mailpoet/trunk/index.php)
-
tags/1.3.10/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.10/languages/how-to-translate.txt (copied) (copied from add-on-contact-form-7-mailpoet/trunk/languages/how-to-translate.txt)
-
tags/1.3.10/readme.txt (copied) (copied from add-on-contact-form-7-mailpoet/trunk/readme.txt)
-
trunk/add-on-contact-form-7-mailpoet.php (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/class-mailpoet-cf7-submit-form.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
add-on-contact-form-7-mailpoet/trunk/add-on-contact-form-7-mailpoet.php
r2089733 r2103858 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.1 05 * Version: 1.3.11 6 6 * Author: Tikweb 7 7 * Author URI: http://www.tikweb.dk/ -
add-on-contact-form-7-mailpoet/trunk/changelog.txt
r2089733 r2103858 1 1 == Changelog == 2 3 = 1.3.11 – 2019-06-10 = 4 * Used MailPoet API to add/update the subscriber 5 * Fixed "sign-up confirmation" bug 2 6 3 7 = 1.3.10 – 2019-05-17 = -
add-on-contact-form-7-mailpoet/trunk/includes/class-mailpoet-cf7-submit-form.php
r2089733 r2103858 14 14 } 15 15 16 16 17 // use MailPoet\Models\Segment; 17 18 use MailPoet\Models\Subscriber; 18 use MailPoet\Subscribers\ConfirmationEmailMailer;19 19 use MailPoet\Models\CustomField; #get all custom field info without value 20 use MailPoet\Settings\SettingsController; #get mailpoet settings 20 21 21 22 if ( ! class_exists( 'MailPoet_CF7_Submit_Form' ) ) { … … 145 146 if ( $subscriber ) { 146 147 $subscriber->withSubscriptions(); 147 $ old_lists = $subscriber->subscriptions;148 149 foreach ( $ old_lists as $key => $value ) {148 $current_lists = $subscriber->subscriptions; 149 150 foreach ( $current_lists as $key => $value ) { 150 151 $list_ids[] = $value['segment_id']; 151 152 } … … 155 156 $new_list_ids = $form_data['fieldVal']; 156 157 157 $ str_to_array= explode( ",", $new_list_ids );158 159 $list_ids = array_merge( $list_ids, $ str_to_array);158 $current_list = explode( ",", $new_list_ids ); 159 160 $list_ids = array_merge( $list_ids, $current_list ); 160 161 } 161 162 } … … 176 177 177 178 179 // Check mailpoet sign-up confirmation 180 $mp_signup_settings = new SettingsController(); 181 $mp_signup_confirmation = $mp_signup_settings->get('signup_confirmation.enabled'); 182 if ( $mp_signup_confirmation ) { 183 $signup_confirm_state = 'unconfirmed'; 184 } else { 185 $signup_confirm_state = 'subscribed'; 186 } 187 178 188 if ( ! empty( $list_ids ) && is_array( $list_ids ) ) { 179 189 $subscribe_data = array( 180 190 'email' => $email, 181 'segments' => $list_ids,182 191 'first_name' => $firstname, 183 192 'last_name' => $lastname, 184 'status' => 'unconfirmed',193 'status' => $signup_confirm_state, 185 194 ); 186 195 … … 202 211 } 203 212 204 //Save subcriber data 205 $subscriber = Subscriber::createOrUpdate( $subscribe_data ); 206 if ( ! $subscriber ) { 207 return; 208 } 209 210 //Send subscriber a welcome mail 211 $sender = new ConfirmationEmailMailer(); 212 $sender->sendConfirmationEmail( $subscriber ); 213 $options = array( 214 'send_confirmation_email' => $signup_confirm_state === 'unconfirmed' ? true : false, 215 'skip_subscriber_notification' => true //fixing double "New subscriber" email 216 ); 217 //Saving new subscriber 218 try { 219 $subscriber = \MailPoet\API\API::MP( 'v1' )->addSubscriber( $subscribe_data, 220 array_unique( $list_ids ), $options ); 221 } catch ( Exception $exception ) { 222 //If subscriber is already subscribed once and unsubscribed later, then again subscribed to any list, change the status to subscribed and add to the list 223 if ( 'This subscriber already exists.' == $exception->getMessage() ) { 224 //Change subscriber status to subscribed 225 $subscribe_data['status'] = 'subscribed'; 226 //Update the status 227 Subscriber::createOrUpdate( $subscribe_data ); 228 //Now subscribe to the new list 229 try { 230 $subscriber = \MailPoet\API\API::MP( 'v1' )->subscribeToLists( $subscribe_data['email'], 231 array_unique( $current_list ) ); 232 233 } catch ( Exception $exception ) { 234 235 } 236 } else { 237 238 } 239 } 240 213 241 214 242 } -
add-on-contact-form-7-mailpoet/trunk/readme.txt
r2089760 r2103858 4 4 Donate link: http://www.tikweb.dk/donate/ 5 5 Requires at least: 4.6 6 Tested up to: 5.2 6 Tested up to: 5.2.1 7 7 Requires PHP: 5.2 8 Stable tag: 1.3.1 08 Stable tag: 1.3.11 9 9 10 10 Add a MailPoet 3 signup field to your Contact Form 7 forms. … … 39 39 https://i.imgur.com/fHrpedY.png 40 40 41 4. Now create any field in contact form 7 same as the custom field that you created in mailpoet. In "Name" field, put the mailpoet s custom field id number which you copied in earlier step.41 4. Now create any field in contact form 7 same as the custom field that you created in mailpoet. In "Name" field, put the mailpoet�s custom field id number which you copied in earlier step. 42 42 https://i.imgur.com/HpuufxY.png 43 43
Note: See TracChangeset
for help on using the changeset viewer.