In managing website content in AnQi CMS, we often encounter various data fields, whereuser_idField is a commonly existing and easy to raise doubts identification. When we get document details from AnQi CMS, thisuser_idWhat exactly represents the document publisher or author? To clearly understand this, we need to analyze the data structure returned by the document interface.
Firstly,/anqiapi-archive/142.htmlThe API returns parameters from the document, looking at the details of the document in it,datathe object indeed contains a field nameduser_idwith the type ofintThis indicates the “User ID”.This field appears in the core attribute list of the document, indicating that it is a system-level, directly associated user identifier.user_idThis 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 that performs the publish operation, as recorded by the system.user_idIt is a key clue, you can use it to further call the user details interface (such as/api-user/3522.html), to obtain specific information such as the username and nickname of the user.
However, there is also an important part in the document details, that is,extrain the provided example return data,extracontains objects,"author": {"name": "作者", "value": "AnqiCMS", "default": ""}such a structure. ThisextraThe field is displayed based on the custom fields set in the document model. This means, in addition to the system automatically associateduser_idIn addition, the safe CMS allows you to define a custom field named "author" in the document model.valueIt can be any string, such as “AnqiCMS”, “Editorial”, “Some Guest Expert”, etc.
This leads to an important distinction:
user_id:It is the internal user account ID of the system, associated with a specific registered user.It serves more for background management, permission control, and behavior tracking of publication functions.user_idThis is the ID of the registered user.extraCustom 'author' information in the field.This is usually a content-level 'author name', 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 some anonymous authors, etc.
For example, a company may want all articles to display "EditorialOr, if the website allows submissions but the submitter is not a registered user, the author name displayed in the document details can also be flexibly handled through custom fields.extra.author.valueIf available, this provides author information that is more in line with the content presentation needs; if the custom author field is not set, or you prefer to display the publisher at the system level, then you can according touser_idGo and 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 frontend page. The true 'author name' in Anqi CMS may be a flexible custom field that exists inextraIn the data, to meet diverse content operation requirements.
Common Questions (FAQ)
1. Why is ituser_idWhat does the value 0 represent?Answer: In the document details of the Anqi CMS,user_idThe value is 0, typically indicating that the document is not explicitly associated with any 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 certain types of system articles are set up this way.
2. If I want to display the document author's name on the frontend,user_idOrextra.author?答:This 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_id,and use this ID to query the user's detailed information (such as username or real name). If your website allows more flexible author attribution (such as pen names, guest authors, team names, etc.), and the custom 'author' field is configured in the background document model, then use it directlyextra.author.valueField to display the author name would be more appropriate. **Practice is to check first**extra.author.valueIf not exists or is empty, backtrack to throughuser_idto obtain the user name.
3. How to set or modify the custom author field of documents in the Anqi CMS backend?答: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 function, and select the model that your current document belongs to.In the field list of this model, you can add a new custom field, such as naming it 'Author', and selecting 'Text' or 'Single line text' as the type.After adding, this 'author' field will appear in the 'Other Field Information' or similar area when publishing or editing documents. You can manually enter the desired author name.extraThe field is in.