When managing website content in AnQi CMS, we often encounter various data fields, includinguser_idA field is a universally existing and easily questionable identifier. When we obtain the document details from Anqi CMS, thisuser_idWhat represents the document publisher or author? To clearly understand this, we need to analyze the data structure returned by the document interface.
Firstly, from/anqiapi-archive/142.htmlTo look at the API return parameters for obtaining document details in the documentdataThe object indeed contains a field nameduser_idwith the type ofintThis indicates a 'User ID'. This field appears in the core attribute list of the document, indicating that it is a system-level identifier directly associated with the document.As a matter of fact, thisuser_idIt will point to the registered user ID who published or last modified the document in the Anqi CMS backend.In other words, it represents the user identity recorded by the system for executing the publication operation.If you want to display "Publisher" on the front end, then thisuser_idThis is a key clue, you can use it to further call the user detail interface (such as/api-user/3522.html), and get specific information such as the username and nickname of the user.
However, there is also an important part in the document details that is worth noting, namelyextraobject. In the provided example returned data,extrathe object includes"author": {"name": "作者", "value": "AnqiCMS", "default": ""}such a structure. ThisextraThe field is displayed based on the custom field set in the document model. This means that in addition to the automatically associated system fields,user_idOutside of that, Anqi CMS also allows you to define a custom field for an "author" in the document model. This custom field'svalueCan be any string, such as "AnqiCMS", "Editorial", "Some guest expert" etc.
This leads to an important distinction:
user_idIt is the internal user account ID associated with a specific registered user.It serves more for background management, permission control, release behavior tracking, and other functions.If the document is published by a registered user through the back-end, then thisuser_idIt is the ID of the registered user.extraCustom "author" information in the field.This usually refers to the 'author name' at the content level, which is manually filled in or set by the website operator for display purposes.It does not necessarily correspond strictly to a registered user ID in the system, and can be used to display pen names, organization names, or anonymous authors, etc.
For example, a company may want all articles to display "Editorial" as the author instead of the specific employee ID of the person who published the article. This is achieved by setting "Editorial" as the author through a custom field.Or, if the website allows submissions but the submitter is not a registered user, the author's name displayed in the document details can also be flexibly handled through custom fields.When displaying content, you can choose to showextra.author.value(If available), provide author information that better meets the content presentation needs; if the custom author field is not set, or you prefer to display the system-level publisher, then you can according touser_idGo query and display the corresponding user's name.
Therefore,user_idThe field indeed indicates the ID of the publisher or creator of the document at the system level, but it may not be the final "author name" displayed on the front-end page. The true "author name" may be a flexible custom field in AnQi CMS, existing inextraThe data, to meet the needs of diversified content operation.
Frequently Asked Questions (FAQ)
1. Why is it sometimesuser_idWhat is the value? Does it represent?Answer: In the document details of Anqi CMS, ifuser_idThe value is 0, usually indicating that the document is not explicitly associated with a registered user in the system, or is content published by the system itself or anonymous users.This may be because the user ID was not specified when the content was imported, or this is how certain types of system articles are set up.
2. If I want to display the document author's name on the front end, I should useuser_idOrextra.author?Answer: It depends on your specific needs. If you want to display the names of the registered users who actually published documents in the content management system, then you should useuser_idAnd through this ID, query the user's detailed information (such as username or real name). If your website allows more flexible author names (such as pen names, guest authors, team names, etc.), and has configured a custom 'author' field in the backend document model, then use it directly.extra.author.valueThe field to display the author's name is more appropriate. **Practice is to check first**extra.author.valueIf not present or empty, then backtrack to throughuser_idGet the user name.
How to set or modify the custom author field in the Anqi CMS backend?Answer: To set or modify the custom author field of the document, you need to enter the AnQi CMS backend management interface.The specific steps are usually: find the "Model Management" or "Content Model" related functions, and select the model that your current document belongs to.In the field list of the model, you can add a new custom field, such as named "author", and select the type as "text" or "single line text".After adding, when publishing or editing a document, you will see this "author" field in the "other field information" or similar area, where you can manually enter the required author name.This, when the document details are obtained through the API, this custom author information will appearextraThe field is incorrect.