WooCommerce Download Permissions For Newly Added Files

The version 2 of WooCommerce had a function where when you added new files to existing products all the existing purchasers received access to the new files as well. That was good when you wanted to give everyone access to the new files. One problem though was that if the downloads were limited in number or time the new files would receive the full access as of the adding.
So if the download was limited to for example 365 days and a purchase was two years ago then the new file was available to this purchaser for a full year after the new file has been added. Not really the desired outcome in this case.
And adding to the issue was that if you edited a file line in the product WooCommerce handled it the same as deleting the old file and adding a new one with the new permissions.
So if you had limited downloads the only choice was to link to a file that never changed its name. Like an archive without version number.

So in version 3 WooCommerce changed the system to not grant access to newly added files at all. Depending on how you like to sell your digital products that may not work well either. And this change may have created issues in the way you sold software. If you always wanted to give access to everyone that wasn’t working any more all of a sudden.
Editing file lines now works by replacing the name and download link and keeping all permissions from the file (line) being edited.
There is a plugin available at Github that emulates the original v2 way of adding permissions that you can add to your site if you want to have the old way of working.

In our business we had the problem that neither solution was satisfactory. We had some unlimited download products and some limited time products. And then we also wanted be able to maybe just generate download permissions for orders placed after a certain date. So the question was – how do we grant new download permissions for new files on old, existing orders?
For this we created a new plugin, MAK WooCommerce Download Permissions, to take care of that for us. With it, after you add files, you can decide to copy existing permissions from another file of the product or you can create new permissions (with download times calculated for the purchase date if applicable). You can do this for all orders, orders after a certain date or not grant any access for old orders at all. The choice is yours for each file you add to a product.

0 – Error decoding JSON data: Syntax error When Updating from Joomla 3.6.2 to 3.6.3 [Solution]

After upgrades to some Joomla sites we run I tried to log into the backend of one of them and to my surprise couldn’t get in. Close inspection showed an error “Error decoding JSON data”.

After some trial and errors to see if any of the security software was acting up I did a thorough Google search and came across quite a few people in the same boat as me with many suggestions and no real solution.

Until I found https://github.com/joomla/joomla-cms/issues/12460 and read through it. Finally the real fix to the problem was posted by alexgarel.

You have to issue a SQL command to clear the offending entries from the database. Previous versions didn’t throw an error when receiving the data, but the new Joomla code isn’t as forgiving. So here it is:

update `xxxx_modules` set params="" WHERE params = "{\"\"}";

The xxxx has to be replaced with the table prefix for your Joomla installation.
If you are not familiar with issuing SQL commands, please contact your webdesigner, webhost or sysadmin to execute it for you. 

If you are still having issues after this command or you don’t want to mess with SQL then please try the program at https://github.com/robwent/joomla-json-db-check – it does a more thorough check and fix on many more tables.
I didn’t need to use it, but it seems to be the most thorough solution out there at this point.

And always be safe – make a backup before any attempted fixes.