Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$edd_licensed_products inconsistent when used outside is_admin() context #8969

Closed
ashleyfae opened this issue Nov 2, 2021 · 0 comments · Fixed by #8971
Closed

$edd_licensed_products inconsistent when used outside is_admin() context #8969

ashleyfae opened this issue Nov 2, 2021 · 0 comments · Fixed by #8971

Comments

@ashleyfae
Copy link
Contributor

Bug Report

Expected behavior

When I have an individual license key activated (not a pass), I expect EDD to always recognize that.

Actual behavior

If the global $edd_licensed_products is referenced outside of the wp-admin context (is_admin()), then EDD can think I have no license keys entered, when actually I do have one entered.

The problem is that some of our extensions, like Software Licensing, only instantiate the EDD_License class if is_admin(). That means the results of $edd_licensed_products can be inconsistent when checked in a non-admin context.

This is a blocker for #8941. There are two cases where I'm using that variable and getting inconsistent results:

  1. When cron is running.
  2. In a REST API response.

Information (if a specific version is affected):

PHP Version:

EDD Version (or branch):

WordPress Version:

Any other relevant information:

In the long term we should refactor how add-ons initialize that class, but we cannot rely on updating all add-ons prior to releasing #8941. So I'm making this issue to work on a semi-gross patch, and I'll make a separate issue for a better long-term solution.

@ashleyfae ashleyfae added this to the 2.11.4 milestone Nov 2, 2021
@ashleyfae ashleyfae self-assigned this Nov 2, 2021
ashleyfae added a commit that referenced this issue Nov 2, 2021
Save $edd_licensed_products to options so it can be referenced outside WP-Admin #8969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant