Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms - Version 1.6.21

Version Description

  • Bugfix: Fix dismissible form preview notices for new forms.
  • Bugfix: Email part with confirmation field prevented form submits when "Preview values before submission" was checked.
Download this release

Release Info

Developer thethemefoundry
Plugin Icon 128x128 Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms
Version 1.6.21
Comparing to
See all releases

Code changes from version 1.6.20 to 1.6.21

happyforms.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://happyforms.me
6
  * Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
7
  * Author: The Theme Foundry
8
- * Version: 1.6.20
9
  * Author URI: https://thethemefoundry.com
10
  * Upgrade URI: https://thethemefoundry.com
11
  */
@@ -13,7 +13,7 @@
13
  /**
14
  * The current version of the plugin.
15
  */
16
- define( 'HAPPYFORMS_VERSION', '1.6.20' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
5
  * Plugin URI: https://happyforms.me
6
  * Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
7
  * Author: The Theme Foundry
8
+ * Version: 1.6.21
9
  * Author URI: https://thethemefoundry.com
10
  * Upgrade URI: https://thethemefoundry.com
11
  */
13
  /**
14
  * The current version of the plugin.
15
  */
16
+ define( 'HAPPYFORMS_VERSION', '1.6.21' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
inc/classes/class-happyforms.php CHANGED
@@ -25,10 +25,6 @@ class HappyForms extends HappyForms_Core {
25
  'dismissible' => true,
26
  );
27
 
28
- if ( 0 === $form['ID'] ) {
29
- $upgrade_notice_args['dismissible'] = false;
30
- }
31
-
32
  $admin_notices->register(
33
  'happyforms_form_' . $form['ID'] . '_upgrade',
34
  sprintf(
25
  'dismissible' => true,
26
  );
27
 
 
 
 
 
28
  $admin_notices->register(
29
  'happyforms_form_' . $form['ID'] . '_upgrade',
30
  sprintf(
inc/core/assets/js/frontend/email.js CHANGED
@@ -19,14 +19,9 @@
19
  },
20
 
21
  initAutocomplete: function() {
22
- var self = this;
23
  var $inputs = $( '[data-serialize]', this.$el );
24
 
25
- $inputs.each( function( index ) {
26
- if ( 0 === index ) {
27
- self.$input = $( this );
28
- }
29
-
30
  var $visualInput = $( this ).next( 'input[type=email]' );
31
  var $select = $visualInput.next( '.happyforms-custom-select-dropdown' );
32
 
19
  },
20
 
21
  initAutocomplete: function() {
 
22
  var $inputs = $( '[data-serialize]', this.$el );
23
 
24
+ $inputs.each( function() {
 
 
 
 
25
  var $visualInput = $( this ).next( 'input[type=email]' );
26
  var $select = $visualInput.next( '.happyforms-custom-select-dropdown' );
27
 
inc/core/assets/js/preview.js CHANGED
@@ -221,18 +221,15 @@
221
 
222
  var $target = $( e.target );
223
  var $parent = $target.parents( '.happyforms-notice' ).first();
224
-
225
- if ( 0 != parent.happyForms.form.get('ID') ) {
226
- var id = $parent.attr( 'id' ).replace( 'happyforms-notice-', '' );
227
- var nonce = $parent.data( 'nonce' );
228
-
229
- $.post( settings.ajaxurl, {
230
- action: 'happyforms_hide_notice',
231
- nid: id,
232
- nonce: nonce
233
- }
234
- );
235
- }
236
 
237
  $parent.fadeOut();
238
  }),
221
 
222
  var $target = $( e.target );
223
  var $parent = $target.parents( '.happyforms-notice' ).first();
224
+ var id = $parent.attr( 'id' ).replace( 'happyforms-notice-', '' );
225
+ var nonce = $parent.data( 'nonce' );
226
+
227
+ $.post( settings.ajaxurl, {
228
+ action: 'happyforms_hide_notice',
229
+ nid: id,
230
+ nonce: nonce
231
+ }
232
+ );
 
 
 
233
 
234
  $parent.fadeOut();
235
  }),
inc/core/classes/class-admin-notices.php CHANGED
@@ -47,6 +47,7 @@ class HappyForms_Admin_Notices {
47
  public function hook() {
48
  add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
49
  add_action( 'happyforms_preview_notices', array( $this, 'display_preview_notices' ) );
 
50
  add_action( 'wp_ajax_happyforms_hide_notice', array( $this, 'handle_ajax' ) );
51
  }
52
 
@@ -195,6 +196,33 @@ class HappyForms_Admin_Notices {
195
  return $this->display( $screen_id );
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  /**
199
  * Get the transient ID for the specified user.
200
  *
@@ -287,7 +315,7 @@ class HappyForms_Admin_Notices {
287
  *
288
  * @return int|boolean
289
  */
290
- private function update_dismissed_notices( $user_id, array $notices ) {
291
  return update_user_meta( $user_id, 'happyforms-dismissed-notices', $notices );
292
  }
293
 
47
  public function hook() {
48
  add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
49
  add_action( 'happyforms_preview_notices', array( $this, 'display_preview_notices' ) );
50
+ add_action( 'happyforms_form_before', array( $this, 'handle_preview_notices' ), 20 );
51
  add_action( 'wp_ajax_happyforms_hide_notice', array( $this, 'handle_ajax' ) );
52
  }
53
 
196
  return $this->display( $screen_id );
197
  }
198
 
199
+ public function handle_preview_notices( $form ) {
200
+ if ( happyforms_is_preview() ) {
201
+ $user_id = get_current_user_id();
202
+ $notices = $this->get_notices( 'happyforms-preview' );
203
+ $dismissed_notices = $this->get_dismissed_notices( $user_id );
204
+
205
+ if ( 0 !== $form['ID'] ) {
206
+ foreach ( $notices as $id => $notice ) {
207
+ if ( 0 === $id ) {
208
+ continue;
209
+ }
210
+
211
+ $new_form_notice_id = str_replace( $form['ID'], 0, $id );
212
+
213
+ if ( in_array( $new_form_notice_id, $dismissed_notices ) && ! in_array( $id, $dismissed_notices ) ) {
214
+ $dismissed_new_form_notice_id_index = array_search( $new_form_notice_id, $dismissed_notices );
215
+ unset( $dismissed_notices[$dismissed_new_form_notice_id_index] );
216
+
217
+ array_push( $dismissed_notices, $id );
218
+ }
219
+ }
220
+
221
+ $this->update_dismissed_notices( $user_id, $dismissed_notices );
222
+ }
223
+ }
224
+ }
225
+
226
  /**
227
  * Get the transient ID for the specified user.
228
  *
315
  *
316
  * @return int|boolean
317
  */
318
+ public function update_dismissed_notices( $user_id, array $notices ) {
319
  return update_user_meta( $user_id, 'happyforms-dismissed-notices', $notices );
320
  }
321
 
inc/core/templates/parts/frontend-email.php CHANGED
@@ -38,7 +38,7 @@
38
 
39
  <div class="happyforms-part__el">
40
  <?php if ( 1 == $part['autocomplete_domains'] ) : ?>
41
- <input type="hidden" name="<?php happyforms_the_part_name( $part, $form ); ?>" value="<?php happyforms_the_part_value( $part, $form, 1 ); ?>" data-serialize />
42
 
43
  <input type="email" name="<?php happyforms_the_part_id( $part, $form ); ?>_dummy_<?php echo time(); ?>" id="<?php happyforms_the_part_id( $part, $form ); ?>_confirmation" value="<?php happyforms_the_part_value( $part, $form, 1 ); ?>" autocomplete="none" <?php if ( 1 == $part['required'] ) : ?> required aria-required="true"<?php endif; ?> <?php happyforms_the_part_attributes( $part, $form, 1 ); ?> />
44
  <?php else: ?>
38
 
39
  <div class="happyforms-part__el">
40
  <?php if ( 1 == $part['autocomplete_domains'] ) : ?>
41
+ <input type="hidden" name="<?php happyforms_the_part_name( $part, $form ); ?>_confirmation" value="<?php happyforms_the_part_value( $part, $form, 1 ); ?>" data-serialize />
42
 
43
  <input type="email" name="<?php happyforms_the_part_id( $part, $form ); ?>_dummy_<?php echo time(); ?>" id="<?php happyforms_the_part_id( $part, $form ); ?>_confirmation" value="<?php happyforms_the_part_value( $part, $form, 1 ); ?>" autocomplete="none" <?php if ( 1 == $part['required'] ) : ?> required aria-required="true"<?php endif; ?> <?php happyforms_the_part_attributes( $part, $form, 1 ); ?> />
44
  <?php else: ?>
languages/happyforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: HappyForms 1.6.20\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2019-02-12 07:53:28+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -17,39 +17,39 @@ msgstr ""
17
  msgid "Don't miss out on these advanced features 🎉"
18
  msgstr ""
19
 
20
- #: inc/classes/class-happyforms.php:36
21
  msgid "Allow folks to easily upload files to your forms."
22
  msgstr ""
23
 
24
- #: inc/classes/class-happyforms.php:37
25
  msgid "Show and hide forms using a date and time scheduler."
26
  msgstr ""
27
 
28
- #: inc/classes/class-happyforms.php:38
29
  msgid "Display your forms in a custom overlay / modal window."
30
  msgstr ""
31
 
32
- #: inc/classes/class-happyforms.php:39
33
  msgid "Shuffle your form questions to create randomized surveys."
34
  msgstr ""
35
 
36
- #: inc/classes/class-happyforms.php:40
37
  msgid "Secure individual forms with strong password protection."
38
  msgstr ""
39
 
40
- #: inc/classes/class-happyforms.php:41
41
  msgid "Limit the number of responses each of your forms get."
42
  msgstr ""
43
 
44
- #: inc/classes/class-happyforms.php:43
45
  msgid "Discover more benefits of upgrading"
46
  msgstr ""
47
 
48
- #: inc/classes/class-happyforms.php:58
49
  msgid "HappyForms Upgrade"
50
  msgstr ""
51
 
52
- #: inc/classes/class-happyforms.php:59
53
  msgid "Upgrade"
54
  msgstr ""
55
 
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: HappyForms 1.6.21\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2019-02-13 08:31:02+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
17
  msgid "Don't miss out on these advanced features 🎉"
18
  msgstr ""
19
 
20
+ #: inc/classes/class-happyforms.php:32
21
  msgid "Allow folks to easily upload files to your forms."
22
  msgstr ""
23
 
24
+ #: inc/classes/class-happyforms.php:33
25
  msgid "Show and hide forms using a date and time scheduler."
26
  msgstr ""
27
 
28
+ #: inc/classes/class-happyforms.php:34
29
  msgid "Display your forms in a custom overlay / modal window."
30
  msgstr ""
31
 
32
+ #: inc/classes/class-happyforms.php:35
33
  msgid "Shuffle your form questions to create randomized surveys."
34
  msgstr ""
35
 
36
+ #: inc/classes/class-happyforms.php:36
37
  msgid "Secure individual forms with strong password protection."
38
  msgstr ""
39
 
40
+ #: inc/classes/class-happyforms.php:37
41
  msgid "Limit the number of responses each of your forms get."
42
  msgstr ""
43
 
44
+ #: inc/classes/class-happyforms.php:39
45
  msgid "Discover more benefits of upgrading"
46
  msgstr ""
47
 
48
+ #: inc/classes/class-happyforms.php:54
49
  msgid "HappyForms Upgrade"
50
  msgstr ""
51
 
52
+ #: inc/classes/class-happyforms.php:55
53
  msgid "Upgrade"
54
  msgstr ""
55
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: contact, contact form, email, feedback form, form, form builder, custom fo
5
  Requires at least: 4.8
6
  Tested up to: 5.0
7
  Requires PHP: 5.3
8
- Stable tag: 1.6.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -99,6 +99,10 @@ Yep! HappyForms free isn't going anywhere but for those looking for even more po
99
 
100
  == Changelog ==
101
 
 
 
 
 
102
  = 1.6.20 =
103
  * Improvement: Better support for emails display name.
104
  * Improvement: Form title now highlights when Build step is opened for easier renaming.
@@ -396,6 +400,9 @@ Yep! HappyForms free isn't going anywhere but for those looking for even more po
396
 
397
  == Upgrade Notice ==
398
 
 
 
 
399
  = 1.6.20 =
400
  * Customize screen and emails bugfixes and improvements.
401
 
5
  Requires at least: 4.8
6
  Tested up to: 5.0
7
  Requires PHP: 5.3
8
+ Stable tag: 1.6.21
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
99
 
100
  == Changelog ==
101
 
102
+ = 1.6.21 =
103
+ * Bugfix: Fix dismissible form preview notices for new forms.
104
+ * Bugfix: Email part with confirmation field prevented form submits when "Preview values before submission" was checked.
105
+
106
  = 1.6.20 =
107
  * Improvement: Better support for emails display name.
108
  * Improvement: Form title now highlights when Build step is opened for easier renaming.
400
 
401
  == Upgrade Notice ==
402
 
403
+ = 1.6.21 =
404
+ * Fix Email part preventing form submits when "Preview values before submission" was checked. Improve form preview notices behavior on new forms.
405
+
406
  = 1.6.20 =
407
  * Customize screen and emails bugfixes and improvements.
408