Fix/autoset code
All Submissions:
- [x] Have you followed the Contributing guidelines?
- [x] Does your code follow the WordPress' coding standards?
- [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
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.