diff --git a/edwiser-bridge/includes/class-eb-user-manager.php b/edwiser-bridge/includes/class-eb-user-manager.php index 80f5d8ec..4784424d 100644 --- a/edwiser-bridge/includes/class-eb-user-manager.php +++ b/edwiser-bridge/includes/class-eb-user-manager.php @@ -1577,7 +1577,7 @@ public function eb_user_email_verify() { if ( 'eb_user_email_verification' === $action ) { $eb_user_email_verification_key = get_user_meta( $verification_id, 'eb_user_email_verification_key', true ); - if ( $verification_key === $eb_user_email_verification_key ) { + if ( ! empty( $verification_key ) && $verification_key === $eb_user_email_verification_key ) { update_user_meta( $verification_id, 'eb_user_email_verified', 1 ); $message = __( 'Your email is verified successfully.', 'edwiser-bridge' ); // create moodle user. diff --git a/edwiser-bridge/public/assets/js/eb-public.js b/edwiser-bridge/public/assets/js/eb-public.js index b64c093a..a4cf516b 100644 --- a/edwiser-bridge/public/assets/js/eb-public.js +++ b/edwiser-bridge/public/assets/js/eb-public.js @@ -340,6 +340,33 @@ ], }); } + + // disable woocomerce quantity input field + $('.eb-pro-product-page-sidebar .quantity-wrap').find('input').prop('disabled', true); + $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-minus').prop('disabled', true); + $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-plus').prop('disabled', true); + + if ($( "#wdm_edwiser_self_enroll" ).length) { + var is_checked = $( "#wdm_edwiser_self_enroll" ).is(':checked'); + if (is_checked) { + $( ".eb-pro-product-page-sidebar .quantity-wrap" ).find('input').prop('disabled', false); + $( ".eb-pro-product-page-sidebar .quantity-wrap .quantity-minus" ).prop('disabled', false); + $( ".eb-pro-product-page-sidebar .quantity-wrap .quantity-plus" ).prop('disabled', false); + } + }; + + $( "#wdm_edwiser_self_enroll" ).change(function() { + if (this.checked) { + $( ".eb-pro-product-page-sidebar .quantity-wrap" ).find('input').prop('disabled', false); + $( ".eb-pro-product-page-sidebar .quantity-wrap .quantity-minus" ).prop('disabled', false); + $( ".eb-pro-product-page-sidebar .quantity-wrap .quantity-plus" ).prop('disabled', false); + } else { + $( ".eb-pro-product-page-sidebar .quantity-wrap" ).find('input').prop('disabled', true); + $( ".eb-pro-product-page-sidebar .quantity-wrap .quantity-minus" ).prop('disabled', true); + $( ".eb-pro-product-page-sidebar .quantity-wrap .quantity-plus" ).prop('disabled', true); + $( ".eb-pro-product-page-sidebar .quantity-wrap" ).find('input').val(1); + } + }); }); })(jQuery);