Content Restriction 2.3 Beta 1 released with improved extension integrations

The 2.3 update of Content Restriction is mainly focused around improving integration with other Easy Digital Downloads Extensions, and also contains a couple of useful improvements.

Recurring Payments integration improvement

The biggest integration improvement is with the Recurring Payments extension, and the fix requires both version 2.3 of Content Restriction, and version 2.8 of Recurring Payments. Previous to version 2.3 of Content Restriction and 2.8 of Recurring Payments, Recurring Payments was doing too good of a job cutting off access to restricted content if the user did not have an active subscription.

For example, if you wanted to restrict content to people with an active yearly subscription, but also wanted to sell a “lifetime” option that never recurs, your lifetime users would actually never get access to the restricted content. This was because it was required that they have an active subscription, which they didn’t have or need. This issue has now been resolved, and you can now restrict content to both recurring products, and to non-recurring products.

New hook added for custom options

There has also been some code refactoring and new hooks introduced. If you are using the edd_cr_metabox hook to add custom options to the Content Restriction metabox, you should now use the edd_cr_restricted_table_before hook instead. The edd_cr_metabox should have never been used to output options, because it exists as part of the required-products table. The hook remains for backwards compatibility purposes, but to give users the best experience, any custom options for Content Restriction should now use the edd_cr_restricted_table_before hook.

Software Licensing integration improvement

Speaking of that new hook, previous to version 2.3 of Content Restriction, integration code for the Software Licensing extension output a custom option to “Require valid licenses” but was using the edd_cr_metabox hook. It has now been updated to use the proper hook, “edd_cr_restricted_table_before”. If you’re looking to see how that works, or copy it for your own purposes, you can see the change, and how it works, in the “includes/integrations/edd-software-licensing.php” file.

Compatibility issues with PHP 7.2 resolved

There was a single issue which output a warning if using PHP 7.2 which was “Warning: count(): Parameter must be an array or an object that implements Countable in user-functions.php on line 30”. This could happen if a non-array was passed into the edd_cr_user_can_access function. Checking for the variable type has now been added, and this issue is resolved.

Fixed output of unlocked pages upon purchase confirmation

In a scenario where a variably-priced product unlocked 2 different pages with 2 different prices, even if the customer only purchased access to one of the prices/pages, both pages were listed as being available (even though only the correct one actually worked). This has now been resolved.

Improved integration with bbPress

If you restrict your bbPress forums to buyers using Content Restriction, previously it would show a message that said “This forum is restricted to buyers”. But it didn’t tell the user which product they should purchase in order to gain access to the forum. That has now been been added, and the message shown to the user matches the message shown in all other content restriction areas.

Added shortcode for users without access

If you’d like to show content to people who haven’t purchased yet, a new shortcode has now been added for that. It is called edd_cr_no_access. On the docs page for Content Restriction there is documentation about how it works.

Improved UI of Content Restriction metabox on pages

To help make it more clear when you have Content Restriction enabled for a page or post, the options for Content Restriction now only show if you actually have Content Restriction options in place. Unrestricted pages have the Content Restriction metabox options hidden behind a checkbox now.

Leave a Reply

Your email address will not be published. Required fields are marked *