History West Midlands is a quarterly magazine. They wanted to use Woocommerce subscriptions in combination with Woocommerce groups to restrict access to content to those with an active subscription, but more than that they wanted a subscription to buy access to exactly 4 issues, the current issue and the next 3, based on the date they subscribed. For this I wrote an extension, Date Based Access.
My plugin takes the 4 months that they plan to publish in, March, June, September, and December, and uses it to get the first issue a user has access to based on the dates of their active subscriptions (if you are logged in of course), and then sets the last day a year later, but also uses the cycling through the user’s subscriptions to get the latest last issue date as well were applicable. These dates are then used to build a user meta Access Issues.
This user meta is used on the my account page, where the user sees the list of issues they have access to.
My extension also changes the shop page as well. For a start the main shop section only shows subscriptions. Then below that in a second loop you can buy back issues. My plugin also builds a start date and end date for the current date, so it knows what issues would a subscription bought today have access to. It uses this to ensure that only back-issues not in the current subscription are for sale, and also excludes issues the user has already bought from this loop as well – again using the access_issues user meta. Finally when a back issue is purchased this is also added to the user’s access_issues meta.
Finally they wanted to use Issuu to allow the user to read the issues they had purchased. For this I created a custom query var view-issue and made it a post meta on the same key. The ?view-issue is passed through the url and used to query the posts and find out if the user has access to that issue, before then building the swf object with the correct issuu url. Job Done.
Do leave a comment if you would like to know more about this project or anything else you want to talk about.
The chances are I built the above for one of my freelance clients. You can hire me at Codeable.io - an WordPress specialist outsourcing site that vets developers to make sure they are of the highest standard.