Skip to content

Commit

Permalink
Merge branch 'develop' into release/7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pvpcookie committed Mar 26, 2024
2 parents d329cae + 18ded78 commit 4be35ae
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dotdigital/dotdigital-for-wordpress",
"version": "7.1.2",
"version": "7.2.0",
"authors": [
{
"name": "Dotdigital",
Expand Down
8 changes: 4 additions & 4 deletions dm_signup_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
* Plugin Name: Dotdigital for WordPress
* Plugin URI: https://integrations.dotdigital.com/technology-partners/wordpress
* Description: Add a "Subscribe to Newsletter" widget to your website that will insert your contact in one of your Dotdigital lists.
* Version: 7.1.2
* Version: 7.2.0
* Author: dotdigital
* Author URI: https://www.dotdigital.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* License: MIT
* License URI: https://opensource.org/licenses/MIT
* Text Domain: dotdigital-wordpress
* Domain Path: /languages
*/
Expand All @@ -24,7 +24,7 @@

require_once __DIR__ . '/vendor/autoload.php';

define( 'DOTDIGITAL_WORDPRESS_VERSION', '7.1.2' );
define( 'DOTDIGITAL_WORDPRESS_VERSION', '7.2.0' );
define( 'DOTDIGITAL_WORDPRESS_PLUGIN_NAME', 'dotdigital-for-wordpress' );
define( 'DOTDIGITAL_WORDPRESS_PLUGIN_SLUG', 'dotdigital_for_wordpress' );
define( 'DOTDIGITAL_WORDPRESS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function ( $list ) {
*/
private function has_missing_required_data_fields( $datafields ) {
foreach ( $datafields as $datafield ) {
if ( $datafield['required'] && empty( $datafield['value'] ) ) {
if ( isset( $datafield['required'] ) && '1' === $datafield['required'] && empty( $datafield['value'] ) ) {
return true;
}
}
Expand Down
7 changes: 4 additions & 3 deletions includes/widget/class-dotdigital-wordpress-sign-up-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,17 @@ public function widget( $args, $instance ) {
wp_parse_args(
$args,
array(
'showtitle' => 1,
'showdesc' => 1,
'showtitle' => 1,
'showdesc' => 1,
'is_ajax' => 0,
)
);

$domain = strval( DOTDIGITAL_WORDPRESS_PLUGIN_NAME );
$showtitle = $args['showtitle'] ?? 1;
$showdesc = $args['showdesc'] ?? 1;
$redirection = ! empty( $args['redirection'] ) ? $args['redirection'] : $this->get_redirection();
$is_ajax = $args['is_ajax'] ?? false;
$is_ajax = $args['is_ajax'] ?? 0;
$widget = $this;
$dd_widget_id = $widget->id . '-' . $this->widget_instance_id++;
require DOTDIGITAL_WORDPRESS_PLUGIN_PATH . 'public/view/widget/dotdigital-wordpress-widget-sign-up.php';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "Dotdigital for WordPress",
"author": "Dotdigital",
"license": "GPL-2.0-or-later",
"license": "MIT",
"homepage": "#",
"main": "build/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions public/class-dotdigital-wordpress-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function render_signup_widget( $atts = array(), $tag = '' ) {
'showtitle' => $atts['showtitle'] ?? 1,
'showdesc' => $atts['showdesc'] ?? 1,
'redirecturl' => $atts['redirection'] ?? null,
'is_ajax' => $atts['with_ajax'] ?? 0,
),
$atts,
$tag
Expand All @@ -139,6 +140,7 @@ public function render_signup_widget( $atts = array(), $tag = '' ) {
'showtitle' => $attributes['showtitle'],
'showdesc' => $attributes['showdesc'],
'redirection' => $attributes['redirecturl'],
'is_ajax' => $attributes['is_ajax'],
)
);

Expand Down
2 changes: 1 addition & 1 deletion public/js/dotdigital-for-wordpress-public.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
function( event ) {
const form = $( this );
const is_ajax = form.find( "input[name='is_ajax']" );
if ( ! is_ajax[ 0 ].value ) {
if ( is_ajax[ 0 ].value !== '1' ) {
return;
}
const email = form.find( "input[name='email']" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class="<?php echo esc_attr( apply_filters( 'public/datafield/' . $name . '/input
<?php
if ( $is_required ) :
?>
data-required="<?php echo 'required'; ?>"
data-required="<?php echo '1'; ?>"
required<?php endif; ?>
/>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion public/view/widget/dotdigital-wordpress-widget-sign-up.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<input type="hidden" name="redirection" value="<?php echo esc_attr( $redirection ); ?>" />
<input type="hidden" name="widget_id" value="<?php echo esc_attr( $dd_widget_id ); ?>" />
<input type="hidden" name="origin" value="<?php echo esc_attr( $widget->get_origin_url() ); ?>" />
<input type="hidden" name="is_ajax" value="<?php echo esc_attr( $is_ajax ); ?>" />
<input type="hidden" name="is_ajax" value="<?php echo $is_ajax ? '1' : '0'; ?>" />
<div class="dotdigital-form-submit">
<button type="submit" name="dm_submit_btn"><?php echo esc_attr( $widget->get_subscribe_button_title() ); ?></button>
</div>
Expand Down
27 changes: 22 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: email marketing, newsletter signup
Requires at least: 5.3
Tested up to: 6.4.3
Requires PHP: 7.4
Stable tag: 7.1.2
Stable tag: 7.2.0
License: MIT
License URI: https://opensource.org/licenses/MIT

Expand Down Expand Up @@ -44,11 +44,19 @@ You can also set redirection for any widget instance using the sidebar settings
= Q. How can I insert a signup form into my posts and pages? =
A. The preferred approach is to use the WordPress editor, and simply drag either of our blocks into the content area. An alternative (useful if your posts and pages don't use the WordPress editor), you can also use the [dotdigital-signup] shortcode to show the form inside the post's content. Shortcode parameters:

showtitle=0 - Hide the title of the widget
showdesc=0 - Hide the description under the title
redirection="URL" - Redirect the user to a custom URL after successful submission
showtitle - Hide the title of the widget (defaults to 0)
showdesc - Hide the description under the title (defaults to 0)
with_ajax - Submit form without reloading page (defaults to 0)
redirection - Redirect the user to a custom URL after successful submission

Example: [dotdigital-signup showtitle=0 showdesc=0 redirection="http://www.example.com"] (will show the form without a title and description and will redirect the user to http://www.example.com on success)
Example:
[dotdigital-signup showtitle=0 showdesc=0 with_ajax=1 redirection="http://www.example.com"]

The form will behave as follows:
- no title
- no description
- form will submit without a page reload
- user will be redirected to http://www.example.com on submit

== Screenshots ==

Expand All @@ -61,6 +69,15 @@ Example: [dotdigital-signup showtitle=0 showdesc=0 redirection="http://www.examp

== Changelog ==

= 7.2.0 =

**What’s new**
- Merchants can now add a `with_ajax` argument to the `[dotdigital-signup]` shortcode.

**Bug fixes**
- We standardised submission payloads between AJAX and non-AJAX modes, resolving an ‘undefined index’ bug in the widget controller.


= 7.1.2 =

**Bug fixes**
Expand Down

0 comments on commit 4be35ae

Please sign in to comment.