diff --git a/assets/scss/admin/_gdpr-consent.scss b/assets/scss/admin/_gdpr-consent.scss index 712cc8ad..63b19427 100644 --- a/assets/scss/admin/_gdpr-consent.scss +++ b/assets/scss/admin/_gdpr-consent.scss @@ -1,3 +1,8 @@ +.fs_on_missing_user +{ + display: none; +} + #fs_marketing_optin { display: none; @@ -6,6 +11,14 @@ padding: 10px; line-height: 1.5em; + #fs_missing_user_notice + { + color: $fs-logo-magenta-color; + padding-bottom: 10px; + margin-bottom: 10px; + border-bottom: 1px solid #ccc; + } + .fs-message { display: block; @@ -78,4 +91,4 @@ margin-right: 20px; } } -} \ No newline at end of file +} diff --git a/includes/class-freemius.php b/includes/class-freemius.php index 018d7ad0..56d2fe20 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -25809,11 +25809,16 @@ private function fetch_user_marketing_flag_status_by_plugins( $user_email, $lice if ( !is_object($decoded) || !isset($decoded->success) || - true !== $decoded->success || !isset( $decoded->data ) || - !is_array( $decoded->data ) + (!is_array( $decoded->data ) && !is_object( $decoded->data )) + // $decoded->data should be Array in case of success and stdObject in case of failure. ) { return false; + } else if ( + isset($decoded->data->error->code) && + 'no_user_for_license' === $decoded->data->error->code + ) { + self::shoot_ajax_failure('no_user_for_license'); } $result = array_merge( $result, $decoded->data ); diff --git a/start.php b/start.php index a615acc3..bc9bd012 100644 --- a/start.php +++ b/start.php @@ -15,7 +15,7 @@ * * @var string */ - $this_sdk_version = '2.10.0.2'; + $this_sdk_version = '2.10.0.3'; #region SDK Selection Logic -------------------------------------------------------------------- diff --git a/templates/connect.php b/templates/connect.php index 4701a78c..46bd48f8 100755 --- a/templates/connect.php +++ b/templates/connect.php @@ -324,6 +324,12 @@ class="wrap<?php if ( ! fs_is_network_admin() && ( ! $fs->is_enable_anonymous() ); ?> <div id="fs_marketing_optin"> + <div id="fs_missing_user_notice" class="fs_on_missing_user"> + <span class="fs-message"> + <?php fs_echo_inline("A user has not yet been associated with the license, which is necessary to prevent unauthorized activation. To assign the license to your user, you agree to share your WP user's full name and email address.", + 'missing-user-notice') ?> + </span> + </div> <span class="fs-message"><?php fs_echo_inline( "Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:", 'contact-for-updates' ) ?></span> <div class="fs-input-container"> <label> @@ -369,7 +375,8 @@ class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'S <input type="hidden" name="is_extensions_tracking_allowed" value="1"> <input type="hidden" name="is_diagnostic_tracking_allowed" value="1"> <button class="button button-primary" tabindex="1" - type="submit"><?php echo esc_html( $button_label ) ?></button> + type="submit"> + <?php echo esc_html( $button_label ) ?></button> </form> <?php else : ?> <form method="post" action="<?php echo WP_FS__ADDRESS ?>/action/service/user/install/"> @@ -382,7 +389,9 @@ class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'S <button class="button button-primary" tabindex="1" type="submit"<?php if ( $require_license_key ) { echo ' disabled="disabled"'; - } ?>><?php echo esc_html( $button_label ) ?></button> + } ?>> + <span class="fs_on_missing_user"><?php echo esc_html( 'Agree and ' ) ?></span> + <?php echo esc_html( $button_label ) ?></button> </form> <?php endif ?> <?php if ( $require_license_key ) : ?> @@ -982,12 +991,19 @@ function updatePrimaryCtaText( actionType ) { $primaryCta.focus(); } }, + hideMissingUserElements = function () { + $('.fs_on_missing_user').hide(); + }, + showMissingUserElements = function () { + $('.fs_on_missing_user').show(); + }, /** * @author Leo Fajardo (@leorw) * @since 2.1.0 */ fetchIsMarketingAllowedFlagAndToggleOptin = function () { var licenseKey = $licenseKeyInput.val(); + hideMissingUserElements(); if (licenseKey.length < 32) { $marketingOptin.hide(); @@ -1024,6 +1040,8 @@ function updatePrimaryCtaText( actionType ) { // Cache result. isMarketingAllowedByLicense[licenseKey] = result.is_marketing_allowed; + } else if ("no_user_for_license" === result.error) { + showMissingUserElements(); } afterMarketingFlagLoaded(); @@ -1040,4 +1058,4 @@ function updatePrimaryCtaText( actionType ) { })(jQuery); </script> <?php - fs_require_once_template( 'api-connectivity-message-js.php' ); \ No newline at end of file + fs_require_once_template( 'api-connectivity-message-js.php' );