How to use the `siteId` parameter to call user detail data across sites in multi-site management?

Calendar 81

In AnQi CMS multi-site management, efficiently sharing and calling data is the key to improving operational efficiency.Especially in the user system, sometimes we need to display or utilize user details from another site on a site, such as a unified user center, cross-site member privilege display, etc.This is provided by Anq CMSsiteIdParameters become a powerful bridge to connect user data across different sites.

Understand the core value of multi-site management.

AnQi CMS stands out with its powerful multi-site management features, allowing us to easily create and independently operate multiple websites from a single backend.Each site can have an independent domain, content, template, and database configuration, which greatly reduces the complexity of managing multiple brands or business lines.However, this independence also brings challenges in certain scenarios, such as when a user registers on Site A, and Site B also needs to obtain their basic information for display or verification, the traditional independent management model seems inadequate.

To solve this problem, Anqi CMS provides a cross-site data call mechanism.It recognizes that, although the sites are independent, the operational logic and data requirements behind them are often interconnected. At this time,siteIdThe parameter has played its role, it is like a map, guiding the system to where it needs to find the data you need.

siteIdParameter: the bridge for cross-site data calls.

siteIdThe parameter plays an important role in AnQi CMS, it can clearly specify which site we want to get data from. This feature is not limited to user data, in fact, it includes document lists (archiveList), category details (categoryDetail)、System Settings(system)、Contact Information(contact), navigation lists(navListMultiple tags support throughsiteIdParameters to specify the data source. This means that once you have masteredsiteIdThe application allows you to be more flexible in data linkage between multiple sites, breaking through information islands.

For cross-site calls, we need to know the unique identifier of the target site, which is itssiteIdThis ID is usually visible in the 'Multi-site Management' list in the Anqi CMS backend, each site has a clear ID.

Focus on user data: how to utilizesiteIdCall user details

Now, let's focus on how to utilizesiteIdParameters to call user detail data across sites. Anqi CMS providesuserDetailTag, used specifically to retrieve detailed information about a specified user.

userDetailThe basic usage of the tag is to combineidparameters to specify the user's ID, then throughnameThe parameter retrieves specific user field information, such as username, avatar, registration time, etc.

For example, if you want to display the name and avatar of a user (such as a special VIP user) with ID 10 from site B on a page of the current site (assuming site A), you can do it like this:

{# 假设我们知道站点B的 siteId 是 2,并且要获取用户ID为 10 的信息 #}
{% userDetail otherUser with name="UserName" id="10" siteId="2" %}
<p>用户名称:{{ otherUser }}</p>

{% userDetail otherUserAvatar with name="AvatarURL" id="10" siteId="2" %}
<p>用户头像:<img src="{{ otherUserAvatar }}" alt="用户头像" /></p>

{# 或者,将所有信息一次性加载到变量中,再逐一取出 #}
{% userDetail userProfile with id="10" siteId="2" %}
<div>
    <h3>{{ userProfile.UserName }}</h3>
    <p>邮箱:{{ userProfile.Email }}</p>
    <p>手机:{{ userProfile.Phone }}</p>
    <img src="{{ userProfile.AvatarURL }}" alt="{{ userProfile.UserName }}的头像" />
    <p>最近登录时间:{{ stampToDate(userProfile.LastLogin, "2006-01-02 15:04") }}</p>
</div>

In this example:

  • {% userDetail otherUser with name="UserName" id="10" siteId="2" %}This line of code indicates the system to gositeIdWith2to the site, searchidWith10the user, and get theirUserNamefield.
  • {% userDetail userProfile with id="10" siteId="2" %}Then it is to load all the available detail data of the user intouserProfilethis variable, and then you can go throughuserProfile.字段名to flexibly call. For example,userProfile.AvatarURLwill display the user's avatar link,userProfile.LastLoginthen it returns the user's last login timestamp,stampToDatethe filter can format it into a readable date and time.

It should be noted that,idThe parameter isuserDetailThe required parameter of the tag, it is used to specify the specific user.siteIdParameters are an optional supplement, when they are omitted, the system will default to fetching user data from the current site. Only when you really need to access user data from other sites do you need to explicitly provide itsiteId.

Application scenarios and precautions

UtilizesiteIdParameter cross-site call of user data, bringing great convenience and flexibility to the operation of your secure CMS multi-site.Imagine that you can display the VIP user list of all sub-brand sites (site B, site C, etc.) on a main brand's official website (site A);Or implement a unified member login module, after the user logs in, no matter which site is accessed, it can recognize the user's identity and display the corresponding personalized content.

Of course, when using this powerful feature, there are also some details to pay attention to:

  1. Performance considerationHowever, each call involves a database query, although cross-site calls are very convenient.If a large number of cross-site calls are made on a page, it may affect the page loading speed.Use it only when necessary and consider caching the call results appropriately.
  2. data permissionsEnsure that the data you call across sites is public or authorized.Although Anqi CMS has strict control over inter-site access in the background, it is still crucial to understand and comply with data privacy and security regulations from the operational level.
  3. siteIdaccuracy: Be sure to confirm that you are usingsiteIdis the correct identifier of the target site. IncorrectsiteIdThis will result in being unable to retrieve data or receiving incorrect data. In the "Multi-site Management" interface of the Anqi CMS backend, you can clearly see each site'ssiteId.

By flexible applicationsiteIdParameter, the multi-site management of AnQi CMS will become more efficient and intelligent, making your website ecosystem more closely connected and unified.


Frequently Asked Questions (FAQ)

1. Where can I see the details of each site?siteId?You can find the list of each created site in the "Multi-site Management" feature interface on the Anqi CMS backend. Each site entry usually clearly shows its corresponding uniquesiteId.

2. What data types can be utilized besides user details?siteIdHow to make cross-site calls with parameters?Of Security CMSsiteIdThe application scope of parameters is very wide, including but not limited to: document lists (archiveList), category details (categoryDetail), system configuration (system)、Contact Information(contactNavigation Menu (navList)and Friends Link(linkList) etc. Just as soon as you see it in the corresponding tag documentsiteIdYou can try to use it for cross-site calls once you see the parameter description.

3. Will cross-site data calls affect the performance of the website?Yes, cross-site data calls essentially increase the complexity of database queries.Although AnQi CMS has considered performance optimization in its design, if a single page performs too many or too frequent cross-site calls, it may extend the page loading time.Recommend that you weigh the pros and cons in actual use, prioritize caching data or reduce unnecessary cross-site queries to ensure **user experience**.

Related articles

What is the specific function of the `Link` generated by the `userDetail` tag, and how to use it correctly?

AnQi CMS is an efficient and flexible content management system, with its powerful template tag function as the core of dynamic content display.In the daily operation of websites, we often need to display information related to users, such as article authors, member homepages, and so on.At this point, the `userDetail` tag comes into play, and what is particularly crucial is the `Link` (user link) field it generates.

2025-11-07

How to determine the user's VIP status based on `ExpireTime` in the template and display an expiration reminder or renewal option?

When operating your website, if you provide membership or VIP services, it is crucial for users to clearly understand their VIP status, when it will expire, and how to renew it, as this is essential for improving user experience and member retention.AnQiCMS (AnQiCMS) leverages its flexible template engine and powerful user management features, allowing you to easily implement these functions in website templates.We all know that Anqi CMS is built with a comprehensive user group management and VIP system, which allows us to conveniently set different levels of user permissions and paid content.

2025-11-07

How to use the `stampToDate` tag for date formatting and conditional judgment for the `ExpireTime` (VIP expiration time) field?

In the daily operation of AnQi CMS, we often need to handle time-related fields, such as the VIP expiration time of users (`ExpireTime`).Correctly display this time information and make flexible conditional judgments based on its status, which is crucial for improving user experience and implementing personalized content display.This article will focus on the `ExpireTime` field, discussing in detail how to use the `stampToDate` tag for date formatting, and combine conditional judgment to implement intelligent management of VIP status.###

2025-11-07

How to retrieve and display the user's exclusive `InviteCode` (invitation code) with the `userDetail` tag?

In AnQiCMS, if you want to display users' exclusive invitation codes on the website page, this usually involves the application of the membership system or referral mechanism.AnQiCMS provides flexible template tags that can help us easily obtain and display various user information, including invitation codes (`InviteCode`). To implement this feature, we mainly use the AnQiCMS `userDetail` tag.

2025-11-07

How to use the `userGroupDetail` tag to retrieve and display the `Id` (ID) of a specified user group?

In AnQi CMS, sometimes we may need to retrieve and display the unique identifier (ID) of a specific user group, such as for conditional judgment in templates, or adjusting page content based on user group ID.The `userGroupDetail` tag provided by AnQi CMS makes it convenient for us to easily obtain detailed information about user groups, including their ID.User group management is one of the core features of Anqicms, which allows us to group users and define different permission levels, even supporting paid content and membership services.

2025-11-07

How does the `userGroupDetail` tag display the `Title` (name) and `Description` (description) of the user group?

AnQiCMS (AnQiCMS) leverages its flexible and powerful template tag system to provide great convenience to website operators.In daily user management and content operations, we often need to display different information based on the user's identity or permissions.The User Group (User Group) serves as a core permission management mechanism in AnQiCMS. Its name and description are crucial for clearly communicating the rights, services, or identity positioning to the users.

2025-11-07

Can the `userGroupDetail` tag accurately determine through the `Level` (level) of the user group

AnQiCMS where the `userGroupDetail` tag accurately locates user levels: the key to personalized content operation In today's increasingly refined era of content marketing, providing personalized content experiences for different user groups has become an important strategy to enhance user satisfaction and conversion rates.AnQiCMS is a powerful enterprise-level content management system that provides many conveniences in this regard.Among these, the user group management feature is the core of achieving this goal. Today

2025-11-07

How to obtain the name and description of a specified user group by user group ID in AnQi CMS template?

In AnQi CMS template development, we often need to display different content based on specific conditions, or extract specific information from the system.User group management is a core function of Anqi CMS, which allows us to classify and control website users in a fine-grained manner.When you need to obtain the name and introduction based on the user group ID, Anqi CMS provides a concise and efficient template tag to achieve this goal.

2025-11-07