pmpro-affiliates icon indicating copy to clipboard operation
pmpro-affiliates copied to clipboard

Fix/autoset code

Open ideadude opened this issue 3 years ago • 0 comments

All Submissions:

Changes proposed in this Pull Request:

This function tries to sync discount codes and affiliates by setting one or the other when you visit a page.

We're now only running this code on the checkout page since this is the only page we really care to sync things. The affiliate code is saved into a cookie so still available on the checkout page.

We try to get the level id to check from the pmpro_level global if available. This prevents a warning and also is smarter about how PMPro checkout pages can work.

Finally, there is code now to prevent the caching of the page when these $_REQUEST vars are set. This will prevent follow up visits from getting the cached affiliate/discount code "for free" just because the previous user who the cache was generated for had that affiliate or code.

Other information:

  • [x] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [x] Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

ideadude avatar Feb 20 '22 21:02 ideadude