Time released subscription content solution


Many use cases discussed on forums involve subscription to time released content. The concept is a fairly straightforward one that involves users subscribing to a specific membership plan (CBSubs handles this nicely) and gaining access to protected content in a timed release fashion. For example a new subscriber sees one article during the first week of membership, a second article during the second week, etc. Some use case variation also call for "turning off" the first week article after first week is completed.

The use case can be summarized as follows:

  • A user subscribes to a specific CBSubs plan and is granted access to all articles in a specific Joomla category.
  • Articles in this CBSubs protected category are further segmented into time periods. Some articles are categorized as period 1 articles, some as period 2 articles, etc.
  • Each subscriber is automatically granted viewing of period 1 articles during the period 1 of the subscription. After period 1 expires, these period 1 articles are no longer accessible (perhaps instead of content a nice message is displayed that informs subscriber that content is no longer viewable). After period 1 expires and period 2 starts, all content of period 2 articles will be viewable. This concept can be extended to as many time periods as use case needs.

Solution Implementation Example

The following solution elements can be used to support this use case:

  • The CBSubs Paid Subscriptions Membership solution can be configured to handle paid (or free) subscriptions that initially grant access to all relevant articles that contain timed release content in them. With CBSubs you can easily protect individual articles or all articles of given Joomla categories (needs the CBSubs Content Integration plugin and the Joomla CBSubs bot - both included in CBSubs package and described in the documentation) and require a subscription (to a CBSubs plan) for access.

  • We can create a new CB date field using the CB Field Manager. Lets name this field cb_subdate and give it a 'Subscription Date' title.
    See relevant screenshot at end of this tutorial.

  • Installing and publishing the CBSubs CB Field Integration plugin (included in the CBSubs package) we can automatically configure our CBSubs plan to populate the cb_subdate field of each new CBSubs plan subscriber with the start date of the subscription.
    Just put 2023-09-30 in the Value: parameter in the CB Fields sub-tab of the CBSubs plan Integration tab. This expression will grab the current date (at time of user subscription) and format it for storage in our previously created CB date field for the specific subscriber.
    See relevant screenshot at end of this tutorial. 

  • Install and publish the CB Query field plugin available to Professional and Developer members. Then create a new query field type from your CB Field Manager. Lets name this query field cb_daysdiffquery and use the following query:

    SELECT DATEDIFF(now(),'[cb_subdate]')

    This select statement will basically return the number of days between today (now) and the date stored in the cb_subdate field.

  • Install and publish the CB Content bot (as a Joomla plugin) available to Professional and Developer members from the Joomlapolis Incubator area projects. This will allow you to implement the following CB substitution logic in the content of area of each time released content articles:

    ---- article content begins below ----
    Your relevant membership subscription is {cb:[cb_daysdiffquery]} days old.
    &#123;cb:[cb:if cb_daysdiffquery>="0" AND cb_daysdiffquery<"15"]Your 15 day period is active[/cb:if]&#125;
    &#123;cb:[cb:if cb_daysdiffquery>"15"]Your 15 day period has ended and this content is no longer available. Other articles are now available for viewing.[/cb:if]&#125;

    &#123cb:[cb:if cb_daysdiffquery>="0" AND cb_daysdiffquery<"15"]

    Timed released content goes here!

    ---- article content ends above ----

The logic illustrated in these steps will only show the specific content for the first 15 days of a subscription. You can expand it of course and create different time periods if you need to support your specific use case.



CB Date Field for Subscription Date

This is the cb_subdate field created using the CB Field Manager.

CBSubs Integration to set date value

This is the CB substitution expression we need to use to get the current date (when subscription starts) and populate the CB date field previously created.

CB Query Field Plugin Installation

CB Query Field plugin must be installed and published before creating a new query field.


CB Query Field in CB Field Manager

CB Query field named cb_daysdiffquery must be created in the CB Field Manager.

CB Query Field SQL Statement

SQL expression that will calculate the number of days elapsed since the subscription date (taken from the cb_subdate field).

CB Content bot Installation

The CB Content Bot Joomla plugin must be installed and published in order to be able to use CB field substitutions in Joomla articles.


Joomla Article with CB Controlled content

Joomla article with CB substitutions to time release content based on elapsed days since subscription (taken from CB query field calculation).

Joomla articled viewed by 1 day old subscriber

This Joomla article when viewed by a 1 day old subscriber will show its timed related content to the subscriber.

Joomla articled viewed by 34 day old subscriber

This Joomla article when viewed by a 34 day old subscriber will not show its timed related content to the subscriber. Instead it will display a relevant message.


Relevant Information

Facebook Twitter LinkedIn