In website operation, providing differentiated content experience for different user groups is an important strategy to enhance user stickiness and achieve content monetization.The user groups and VIP system of AnQiCMS (AnQiCMS) are the key functions that help us achieve this goal.By flexibly setting the display permissions of content, you can easily create paid content, exclusive member articles, or tiered reading services, making your website content more valuable.

Learn more about Anqi CMS user groups and VIP system

The AnQi CMS built-in user group management and VIP system provides a powerful permission control tool for website administrators.In simple terms, it allows you to categorize website users into different "user groups", such as "normal users", "registered members", "VIP members", "SVIP members", and so on.Each user group can be assigned a specific "Level", and the higher the level, the more privileges it usually means.The VIP level is often an indication of these user groups, through purchase or meeting specific conditions, users can enter higher-level user groups and unlock 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 services of different membership levels to make users feel noble and enhance their loyalty to the website.
  • Fine-tuned operation:Tailor-made content for different user groups to achieve more accurate user operation.

Set the reading permissions of the content: core operation.

The AnQi CMS controls access to content by setting a "Read Level" (ReadLevel) at the time of content publishing.When you create or edit articles, products, and other documents in the background, you will usually find an option for '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 the content. For example:

  • If an article's reading level is set to0It means that all users (including those who are not logged in) can read for free.
  • If it is set to1It may mean that only the lowest-level members can read.
  • If it is set to5Only advanced VIP members may access it.

By setting different reading levels for different content, you can easily build a hierarchical content system.

Display of front-end content: template magic

After setting the content reading level in the background, how can this permission control be implemented on the website front-end to allow different users to see different content prompts or actual content?This needs to make some modifications to the AnQi CMS template files.

Anqi CMS uses a template engine syntax similar to Django, throughifLogic judgment tags, combined with obtaining the current user information and content reading level tags, we can easily realize conditional display on the front-end.

The basic idea is:

  1. Get the level of the current visiting user.
  2. Get the reading level required for the current content.
  3. Compare these levels, if the user's 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 of the article detail page, usuallytemplate/您的模板名称/archive/detail.html.

First, we need to obtain the user group level of the currently logged-in user. In the Anqi CMS template, it is usually possible to do so throughuserThe object directly accesses the current user's information. Ifuserthe object is unavailable, you may need to use{% userDetail %}and{% userGroupDetail %}tags to obtain. For convenience, we assumeuser.LevelYou can directly obtain the current user's level (the level of an unlogged user is usually 0 or the default lowest level). At the same time, the reading level of the current article can be obtained directly through{{archive.ReadLevel}}Retrieve.

{# 假设您已登录,且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 pass 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 title, metadata, and full text content of the article (articleContent|safeUsed to safely render HTML content).
  • If the condition is false, display a restricted prompt, including the article summary (archive.Description) and links to log in or upgrade to VIP.

In this way, 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, it is all up to you.

Step-by-step guide: Make your content smarter

  1. Configure user groups and VIP levels in the background:Log in to the Anqi CMS backend, find the 'User Group Management' feature under 'Admin Management'.Here, you can create or edit different user groups and assign them a unique 'level' (Level). For example:

    • 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.
  2. Set reading permissions when publishing or editing content:In the "Content Management", whether it is to publish new documents (articles, products, etc.) or edit existing documents, find the "Other Parameters" section in the editing interface.Here, you will see a field named 'Reading Level' (or similar). According to the target audience you want for the content, enter the corresponding numerical rating.For example, an exclusive in-depth report can be set to "Level 5", while a regular news can be set to "Level 0".

  3. The modification of the front-end template file:This step is crucial, as it determines how the content is presented to the user.

    • Locate the template file:According to your website structure, find the template file that needs to be implemented for content permission control, usually the detail page template (such astemplate/default/archive/detail.htmlortemplate/default/product/detail.html)
    • Get the user level and content level:Make sure 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 provided in the above text{% if %}The code snippet is implanted into your template, and the display of content is determined based on the comparison 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 message displayed when the user does not have access is friendly and guiding, encouraging them to register or upgrade instead of simply rejecting access粗暴地拒绝访问。

Content operation strategy and thinking

Now