Skip to content

Commit

Permalink
Version bump to 3.2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iamprazol committed Jun 6, 2024
1 parent 54019e9 commit be056c9
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 153 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
= 3.2.1.1 - 06/06/2024 =
* Dev - Added filter hook to to check user instance.
* Fix - Notice not being dismissed.
* Fix - Check function exists before checking capabilities.

= 3.2.1 - 31/05/2024 =
* Enhance - Smart tags picker design.
* Enhance - All forms list table design.
Expand Down
91 changes: 58 additions & 33 deletions assets/js/admin/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1301,9 +1301,8 @@
.find(".ur-radio-trail-recurring-period")
.val();

var trail_period_enable = $single_item
.find(".ur-general-setting-block")
.find('input[data-field="trail_period"]')
var trail_period_enable = $(element)
.find(".ur-radio-enable-trail-period")
.val();

if (
Expand Down Expand Up @@ -3367,6 +3366,47 @@
}
});

$(".ur-radio-enable-trail-period").each(
function () {
if ($(this).is(":checked")) {
$(this)
.closest(".ur-subscription-plan")
.find(
".ur-subscription-trail-period-option"
)
.show();
} else {
$(this)
.closest(".ur-subscription-plan")
.find(
".ur-subscription-trail-period-option"
)
.hide();
}
$(this).on("change", function () {
if ($(this).is(":checked")) {
$(this)
.closest(
".ur-subscription-plan"
)
.find(
".ur-subscription-trail-period-option"
)
.show();
} else {
$(this)
.closest(
".ur-subscription-plan"
)
.find(
".ur-subscription-trail-period-option"
)
.hide();
}
});
}
);

break;
case "selling_price":
if (!$this_obj.is(":checked")) {
Expand Down Expand Up @@ -3394,36 +3434,6 @@
});
break;
case "trail_period":
if (!$this_obj.is(":checked")) {
$(this)
.closest(".ur-general-setting-block")
.find(
".ur-subscription-trail-period-option"
)
.hide();
}

$this_obj.on("change", function () {
$(this)
.closest(".ur-general-setting-block")
.find(
".ur-subscription-trail-period-option"
)
.toggle();

$(".ur-selected-item.ur-item-active")
.find(".ur-general-setting-block")
.find(
".ur-subscription-trail-period-option"
)
.toggle();
});
$this_obj.on("change", function () {
URFormBuilder.trigger_general_setting_trail_period(
$(this)
);
});
break;
case "placeholder":
$this_obj.on("keyup", function () {
URFormBuilder.trigger_general_setting_placeholder(
Expand Down Expand Up @@ -4681,6 +4691,20 @@
.find(".ur-radio-trail-recurring-period")
.val();

var trail_period_enable_val = $(element)
.find(".ur-radio-enable-trail-period")
.prop("checked")
? "on"
: "false";

wrapper
.find(
".ur-general-setting-options li:nth(" +
index +
") .ur-radio-enable-trail-period"
)
.val(trail_period_enable_val);

wrapper
.find(
".ur-general-setting-options li:nth(" +
Expand Down Expand Up @@ -4721,6 +4745,7 @@
recurring_period: recurring_period,
trail_interval_count: trail_interval_count,
trail_recurring_period: trail_recurring_period,
trail_period_enable_val: trail_period_enable_val,
currency: currency,
checkbox: checkbox
});
Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin/form-builder.min.js

Large diffs are not rendered by default.

47 changes: 26 additions & 21 deletions assets/js/frontend/user-registration-form-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
if (dataTip) {
instance.content(dataTip);
}
},
}
};
$(".user-registration-help-tip").tooltipster(tooltipster_args);
}
Expand All @@ -95,20 +95,23 @@
//required field
$.validator.methods.required = function (value, element, param) {
// Check if dependency is met
if ( !this.depend( param, element ) ) {
return "dependency-mismatch";
}
if ( element.nodeName.toLowerCase() === "select" ) {

// Could be an array for select-multiple or a string, both are fine this way
var val = $( element ).val();
return val && val.length > 0;
}
if ( this.checkable( element ) ) {
return this.getLength( value, element ) > 0;
}
return value.trim() !== undefined && value.trim() !== null && value.trim().length > 0;
}
if (!this.depend(param, element)) {
return "dependency-mismatch";
}
if (element.nodeName.toLowerCase() === "select") {
// Could be an array for select-multiple or a string, both are fine this way
var val = $(element).val();
return val && val.length > 0;
}
if (this.checkable(element)) {
return this.getLength(value, element) > 0;
}
return (
value.trim() !== undefined &&
value.trim() !== null &&
value.trim().length > 0
);
};

/**
* Validation for min words.
Expand Down Expand Up @@ -212,7 +215,9 @@
validClass: "user-registration-valid",
ignore: function (index, element) {
// Return true to ignore the element, false to include it in validation
if ( $(element).closest(".ur-field-item").is(":hidden") ) {
if (
$(element).closest(".ur-field-item").is(":hidden")
) {
return true;
}
return (
Expand Down Expand Up @@ -354,7 +359,7 @@
}

return true;
},
}
});
});
},
Expand All @@ -366,7 +371,7 @@
email: user_registration_params.message_email_fields,
number: user_registration_params.message_number_fields,
confirmpassword:
user_registration_params.message_confirm_password_fields,
user_registration_params.message_confirm_password_fields
});

var $this = $(this),
Expand Down Expand Up @@ -457,7 +462,7 @@
user_registration_params.message_min_words_fields.replace(
"%qty%",
minWordsValidator.wordsValidator
),
)
};
});
}
Expand All @@ -470,7 +475,7 @@

rules.user_confirm_email = {
required: true,
equalTo: "#" + form_id + " #user_email",
equalTo: "#" + form_id + " #user_email"
};
messages.user_confirm_email = {
required: user_registration_params.message_required_fields,
Expand Down Expand Up @@ -600,7 +605,7 @@
element.step
);
};
},
}
};

$(window).on("load", function () {
Expand Down
3 changes: 1 addition & 2 deletions includes/admin/class-ur-admin-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public function admin_scripts() {
)
);

wp_enqueue_script( 'ur-notice', UR()->plugin_url() . '/assets/js/admin/ur-notice' . $suffix . '.js', array(), UR_VERSION, false );
wp_localize_script(
'ur-notice',
'ur_notice_params',
Expand Down Expand Up @@ -415,8 +416,6 @@ public function admin_scripts() {
);
wp_enqueue_script( 'user-registration-form-modal-js' );
wp_enqueue_script( 'ur-enhanced-select' );

wp_enqueue_script( 'ur-notice', UR()->plugin_url() . '/assets/js/admin/ur-notice' . $suffix . '.js', array(), UR_VERSION, false );
}

// Enqueue flatpickr on user profile screen.
Expand Down
11 changes: 10 additions & 1 deletion includes/admin/class-ur-admin-user-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ public function __construct( $user = null ) {
$user = get_userdata( $user );
}

if ( ! ( $user instanceof WP_User ) ) {
$user_instance_check = $user instanceof WP_User;

/**
* Filter to check user instancec.
*
* @param boolean User instancce found.
*/
$user_instance_check = apply_filters( 'user_registration_user_instance_check', $user_instance_check, $user );

if ( ! $user_instance_check ) {
throw new Exception( esc_html__( 'Impossible to create an UR_Admin_User_Manager object. Unkwon data type.', 'user-registration' ) );
}

Expand Down
6 changes: 4 additions & 2 deletions includes/admin/updater/class-ur-addon-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ class UR_AddOn_Updater {
* @param array $_api_data Optional data to send with API calls.
*/
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
if ( ! current_user_can( 'manage_options' ) ) {
return false;
if ( function_exists( 'wp_get_current_user' ) ) {
if ( ! current_user_can( 'manage_options' ) ) {
return false;
}
}

global $edd_plugin_data;
Expand Down
2 changes: 1 addition & 1 deletion includes/class-ur-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ public static function form_save_action() {
*/
do_action( 'user_registration_after_form_settings_save', wp_unslash( $_POST['data'] ) ); //phpcs:ignore

wp_send_json_success(
wp_send_json_success(
array(
'data' => $post_data,
'post_id' => $post_id,
Expand Down
Loading

0 comments on commit be056c9

Please sign in to comment.