'How do I add an "author" field in the strapi cms?

I can't figure out how to set up the links. I have created a collection. I need an creator to be automatically specified in that record when adding a record to the collection. How do I do that?



Solution 1:[1]

Strapi does not support it by default. As mentioned in this form you can achieve it by editing the strapi's controller. But I will not recommend you to edit the strapi controller at all. Please avoid it.

There is a simple and better solution to this. You can achieve this by creating one to one relationship. Create an author table/collection. Make one to one relationship with your other collection. You can make it a required option as well. So whenever someone creates an entry they have to select an author from your already created collection of authors. And now you can get relation in your API and use it wherever you want to.

Solution 2:[2]

As stated in my comment, Strapi (tested on v3) comes with a created by field. To ascertain the claim, the following steps can be followed;

  1. Create a new content type. Here I am setting only one field, called test enter image description here

  2. Add an entry for that content type. Notice the last update and by field on the right. enter image description here

  3. Save and open the entry. The last update and by fields have been automatically populated. enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simran Singh
Solution 2 Isfaaq