We had an interesting project yesterday, which consisted of customizing Docman (a Joomla extension that allows you to distribute documents either for free or for a fee on your website) in order to accept subscriptions.
Here’s what the client wanted:
- If the document is priced at 0, then the registered member can download it for free.
- If the document is priced at an amount more than 0, then the registered member should pay for it in order to download it.
- If the document is priced at -1, then the registered member should subscribe to one of our client’s subscription plans (plan a) in order to download it.
- If the document is priced at -2, then the registered member should subscribe to another one of our client’s subscription plans (plan b) in order download it.
Each subscription plan served for a year and after the year the registered member has to buy subscription again in order to still be able to download the documents.
Of course, Docman, in its default incarnation, only has the first two options by default, so we had to customize it. Here’s what we did:
- We added fields to the users table to reflect the registration status to each plan (for example, we have a field called
plan_a which is a boolean, and is defaulted to 0, and another field which is
plan_a_expiry_date, which is of type date). You can see how to add fields to the user’s form here.
- We then accommodated the different Docman files to show the appropriate buttons and do the appropriate actions depending on the status of the registered member. This was a long job, as we had to change many files in the process.
- We finally accommodated the Docman PayPal IPN component (specifically the
docmanpaypal.class.php file) to the change so that it updates the status of the user (for example, set the flag
plan_a to 1 and set the field
plan_a_expiry_date to :
DATE_ADD(CURDATE(), INTERVAL 1 YEAR))
The job took us around 2 days (or 16 hours) in order to fully finish, and we’re glad to say that our customer is happy. If you need help modifying your own version of Docman, then don’t hesitate to contact us, we’re here to help you 24/7/365, and our fees are very reasonable!