[На английском языке]
Smart Subscriptions user profile plugin supports custom URL parameters in links to registration. This feature can be useful for web designers who would like to place direct links to registration on a web page. Such links can be designed as buttons to improve the visual impact thus motivating site visitors to register with a paid subscription.
Standard "Create an Account" link in core Joomla login form allows users to choose from all available accounts during registration. Adding custom URL parameters to direct registration links makes the difference: registration form will offer only one subscription depending on parameter's value. It makes possible to design several links (buttons) each one "connected" to a registration with a subscription preselected.
Custom URL parameters for user profile plugin use the following template: limit_acc=<account>, where <account> can be an ID of related Smart Subsciptions account or a comma-separated list if account ID-s, in the latter case user will be able to select subscription but only out of the set of those with ID-s listed in "limit_acc" parameter.
Although the main use case of direct links to accounts covers "new registration" scenarios on your site, direct links can also work for already logged-in users, so that they can upgrade their subscriptions. Anyways it is recommended to display direct links in a "Custom" (free HTML) module on your site (possibly embedded to an article via "loadposition" directive, see the sample below) - it allows to control who will actually see the links.
Typically (for new registration scenario) you should set "Access" to "Guest" for such modules. Registered and logged-in users will not see it. For extended scenarios you can create a module with "Registered" access with account links directing to "edit profile" form instead of registration. In all cases it is your resposability as site administrator to provide correct links using the following as a guide:
- for new registrations (guest view) - check your site current "Create Account" URL. Add "limit_acc" parameter at the end of the URL (prepend it with "?" or "&" sign depending on if "?" is already in URL), setting the value to account id (or comma-separated list of ids) to limit account selection to.
- for existing logged-in users (registered view) - check your site current "Edit Profile" URL. Add "limit_acc" parameter at the end of the URL (prepend it with "?" or "&" sign depending on if "?" is already in URL), setting the value to account id (or comma-separated list of ids) to limit account selection to.
Account id is hardcoded in direct links, normally you should create them when you have your accounts setup and stable. There is no check if current direct link to account is valid, if you remove / add accounts in Smart Subscriptions you should update existing direct links accordingly.
If you plan to use direct links for new registrations only, that's all there is to it, you can scroll down to samples. Otherwise keep reading.
Direct links to edit profile view for logged-in users if displayed to all "registered" will display account selection according to "limit_acc" URL parameter value, disregarding current user's active subscription.
Let's see an example: let's imagine that currently you have 4 available account on your site and added 4 user groups and 4 view levels (to keep things as simple as possible)
- Free (id 1) - "registered group" - "free view level"
- Basic (id 2) - "basic group" - "basic view level"
- Standard (id 3) - "standard group" - "standard view level"
- Advanced (id 4) - "advanced group" - "advanced view level"
All these accounts groups view levels inherit directly or indirectly from "Registered" view access level. It means that every logged-in user will see a module with "Registered" view permission. If you are uncertain about Smart Subscriptions accounts configuration you should read this first.
Also let's say that all direct links in module limit selection to one account only (e.g. $limit_acc=2 or &limit_acc=4). If current user already has an active subscription and is logged-in, clicking on a link to edit profile in such a module can result in:
- A link to a higher account is selected - user can upgrade. This is OK.
- A link to user's current account is selected - edit profile form will appear, current active account will show up. The user will be able to edit other profile setting but account selection will not be active. This is functionally OK but if a user comes from a page dedicated to subscription upgrades he can be confused.
- A link to a lower account is selected - the only manner to save profile would be to downgrade a subscription. If a user comes from a page dedicated to subscription upgrades he can be really confused.
If user groups for Smart Subscriptions are configured using inheritance (this is a typical approach), creating modules with view levels other than registered will not make sense. For example, if your intention is to show links to "Standard" and "Advanced" subscriptions only to "Basic" subscription owners setting view level for such a module to "basic view level" will not work. Due to view level inheritance in Joomla (which follows user group inheritance) a module wtih "basic view level" will be accessibe also by users who have a higher subscription, e.g. "standard" and "advanced" thus breaking the whole idea.
You can control view permissions for a module with links to accounts strictly on user group basis only if related user groups do not inherit one from another, i.e. if all groups are at the same level in user groups tree. Please, keep in mind that this is not a recommended configuration and it will change the way how Smart Subscriptions controls site resources your users have access to. Normally higher accounts owners should have access to all resources available for lower accounts, so that "updage subscription" concept makes sense: after upgrade user have access to new resources without losing those he could already access before upgrade. This is exacly what Joomla user group inheritance was designed for.
That said, there are two possible solutions:
- Only display direct links to registration, i.e. to guests only to prevent confusion.
- Display direct links to edit profile for all logged-in users, but call it "change your current subscription". Using terms like "upgrade subscription" can cause confusion.
Depending on if you are logged in or not below you should see sample links to registration or to edit your profile. You can test them first without actually registering or updating your profile. Just return to this page using "back" in your browser and click another link.