There are many scenarios where you want to allow someone to have access to part of the site for a defined period of time. Even better if they can purchase that access online, without the site administrator having to become involved. This page explains the principles involved, and explains how to configure the system to do this.
The Subscribers usergroup
To allow a visitor to have permission to access a page of 'premium content' on the site you need to create a usergroup (Let's call it 'Subscribers'), and for that page assign View Page permission to that usergroup, and remove view page permission from any other usergroups other people might be in (most notably the Visitor usergroup that everyone is automatically a member of).
With this set up, you can user the User Manager to grant an individual membership of the Subscriber usergroup, and they will then be able to login and view the premium content. The User Manager defaults to granting membership to a usergroup without any time restriction - "Always". However you can override this to specify an expiry date when they will no-longer be a member of that usergroup.
What would be nice is if the user can purchase their own access, and as a result of that purchase, the settings in the user manager are filled in for them, without the site administrator doing it. To do this, you need to use the normal ecommerce model, but add two special fields in to the Product form:
- You need a field of datatype: "Usergroup". When you come to define your subscription product, this will be used to specify the usergroup "Subscribers" that their purchase will grant them mebership of.
- You also need a field of datatype "Timespan". When you define your product, this field contains the duration they are purchasing - a month, year, etc.
Naturally you can have any number of records in the Product form, so people can choose the duration they would like to purchase.
You can also have several different Usergroups, and allow them to choose which one they want to get membership of.
In the Sale View, you need to map the Usergroup field to the "User Group" dopdown, and the Timespan field to the "Expiry" dropdown.
It is important that you ensure the user is logged in before they complete their purchase, otherwise the system will not be able to know which user to assign the membership to.
Then when the purchase is made, the system will adjust their membership automatically.
If they are already a member, then their purchase extends their membership from the original expiry date, adding it on to the end. If they were previously a member, but that has already expired, that is disregarded and their new membership starts from now.
If as an administrator you want to adjust someone's membership period, say to give them some extra time, you can simply adjust the settings through the User Manager. Future transactions for the user will take note of the expiry date there, regardless of whether it was set manually or through an ecommerce transaction.