In website operation, providing differentiated content experiences for different user groups is an important strategy to enhance user stickiness and realize content monetization.The user groups and VIP system of AnQiCMS (AnQiCMS) are the key functions that help us achieve this goal.Through flexible content display permissions, you can easily create paid content, exclusive member articles, or tiered reading services, making your website content more valuable.
Deeply understand the user groups and VIP system of Anqi CMS
The built-in user group management and VIP system of Anqi CMS provides a powerful set of permission control tools for website administrators.In simple terms, it allows you to categorize website users into different "user groups", such as "ordinary users", "registered members", "VIP members", and "SVIP members", etc.Each user group can be assigned a specific "Level", the higher the level, the more privileges it usually means.VIP levels are often a reflection of these user groups. By purchasing or upgrading through specific conditions, users can enter higher-level user groups, thereby unlocking more exclusive content and features.
The core value of this system lies in:
- Content monetization:You can set VIP reading permissions for high-quality exclusive content to attract users to pay for subscriptions.
- Member loyalty:Provide different levels of membership services to make users feel dignified and enhance their loyalty to the website.
- Fine-grained operation:Provide customized content for different user groups to achieve more accurate user operation.
Set the reading permissions of the content: core operation
The CMS ensures content access control by setting a "Read Level" during content publication.When you create or edit articles, products, and other documents in the background, you usually find an option called 'Reading Level' in the 'Other Parameters' or a similar area.
This reading level is a number that defines the minimum user group level required to access this content. For example:
- If a reading level is set for an article,
0,表示所有用户(包括未登录用户)都可以免费阅读。 - 如果设为
1,可能意味着只有最低级的会员才能阅读。 - 如果设为
5Then, only senior VIP members may have access.
By setting different reading levels for different content, you can easily build a hierarchical content system.
Front-end content display conditions: Template Magic
How to implement this permission control on the website front-end after setting the content reading level in the background, so that different users can see different content prompts or actual content?This needs to make some modifications to the template files of the Anqi CMS.
Anqi CMS adopts a template engine syntax similar to Django,ifLogic judgment label, combining the tags of obtaining the current user's information and content reading level, we can easily achieve conditional display on the front-end.
The basic idea is:
- Obtain the level of the current visiting user.
- Obtain the reading level required for the current content.
- Compare these levels, if the user level reaches or exceeds the level required for the content, then display the full content; otherwise, display a prompt message or partial content.
Assuming you are editing the template file for the article detail page, usuallytemplate/您的模板名称/archive/detail.html.
Firstly, we need to obtain the user group level of the currently logged-in user. In the template of Anqi CMS, it is usually possible touserObject directly accesses the current user's information. Ifuserthe object is not available, you may need to use{% userDetail %}and{% userGroupDetail %}labels to retrieve. For convenience, we assumeuser.Level可以直接获取当前用户的等级(未登录用户等级通常为0或默认最低等级)。同时,当前文章的阅读等级可以直接通过{{archive.ReadLevel}}retrieved.
{# 假设您已登录,且user对象中包含用户等级,当前文章对象为archive #}
{% if user.Level >= archive.ReadLevel %}
{# 用户等级满足,显示完整文章内容 #}
<div class="article-full-content">
<h1>{{archive.Title}}</h1>
<div class="article-meta">
<span>发布日期: {{stampToDate(archive.CreatedTime, "2006-01-02")}}</span>
<span>阅读量: {{archive.Views}}</span>
</div>
<div>
{%- archiveDetail articleContent with name="Content" %}
{{articleContent|safe}}
</div>
</div>
{% else %}
{# 用户等级不足,显示提示信息或部分内容 #}
<div class="article-restricted">
<h1>{{archive.Title}}</h1>
<div class="article-teaser">
{# 可以显示文章简介或者部分内容作为预览 #}
<p>{{archive.Description}}</p>
<p>...</p>
</div>
<div class="access-prompt">
<p>此为VIP专享内容,您的当前等级无法阅读。</p>
<p>请<a href="/login">登录</a>或<a href="/upgrade-vip">升级VIP会员</a>解锁完整内容!</p>
{# 您也可以在这里根据需要提供不同VIP等级的介绍或升级链接 #}
</div>
</div>
{% endif %}
In this code block:
- We first go through
{% if user.Level >= archive.ReadLevel %}Determine if the current user's level is sufficient to read the article. - If the condition is true, then display the article's title, metadata, and full content (
articleContent|safeUsed to safely render HTML content). - If the condition is false, display a restricted prompt, including the article summary (
archive.Description) and a link to guide the user to log in or upgrade to VIP.
Through this method, you can flexibly control the display of content according to your actual needs, whether it is completely hidden, showing a partial preview, or displaying different placeholders, all of which is up to you.
Step-by-step operation guide: Make your content smarter
Background configuration of user groups and VIP levels:Enter the AnQi CMS backend, find the "User Group Management" feature under "Administrator Management.Here, you can create or edit different user groups and assign them a unique "level".
- Normal user: Level 0
- Registered member: Level 1
- VIP member: Level 5
- SVIP Member: Level 10 Ensure that you have set clear levels for each user group, as this will directly affect content access permissions.
Set reading permissions when publishing or editing content:In the "Content ManagementHere, you will see a field named "Reading Level" (or similar name). According to the target audience you want this content to be aimed at, enter the corresponding numerical rating.For example, an exclusive in-depth report can be set to "Level 5
Front-end template file modification:This step is crucial, as it determines how the content is presented to the user.
- 定位template file:According to the structure of your website, find the template file that needs to be implemented for content permission control, which is usually the detail page template (such as
template/default/archive/detail.htmlortemplate/default/product/detail.html). - Get the user level and content level:Ensure that your template can retrieve the current user's level (for example
{{user.Level}}) and the reading level of the current content (for example{{archive.ReadLevel}}). - Apply conditional judgment logic:Take the above-provided
{% if %}The code snippet is implanted into your template, and the decision to display which content is made based on the comparison result of user level and content level.You can display the full article, an article summary, or directly prompt the user to upgrade according to the design requirements. - Beautify the prompt information:Ensure that the prompt information displayed when the user does not have access is friendly and guiding, encouraging them to register or upgrade instead of simply rejecting access粗暴地拒绝访问.
- 定位template file:According to the structure of your website, find the template file that needs to be implemented for content permission control, which is usually the detail page template (such as
Content operation strategy and thinking
Hence