Hi
How do I get the user / Author from a content type? (i’m using php sdk)
I know how to get for example getTitle and so forth.
Thankful for any help.
Hi
How do I get the user / Author from a content type? (i’m using php sdk)
I know how to get for example getTitle and so forth.
Thankful for any help.
Hey @john.svensson!
I don’t think it’s possible to get author of content type
. Could you please provide a bit more context about your use case?
It’s possible to get user who created an entry and who updated it, i.e. https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/entries/entry/get-a-single-entry/console/php/.
You’ll get createdBy
and updatedBy
in scope of getEntry
call.
Please let me know if I misunderstood your question.
Tnx for the response! Really appreciate the help!
I’m like new to this, but I’m trying to create a blog-like site and want to output the author of every post. So you got it right! Tho I can’t seem to get createdBy and updatedBy in scope of getEntry call.
I tried the link you posted but my return-json doesn’t include anything close to author?
Am I missing something?
Hi @hej,
Because Contentful was designed as more of a content infrastructure than a turnkey CMS, some things work a little differently than you might expect. Authorship is one of them.
The “created_by” and “updated_by” are only available in the Management API for security and compliance reasons. If you’d like to show an Author, my recommendation would be this:
Now you can easily set who the author is for any post, independently of who actually entered the content (which is great if you have a more complex editorial workflow, with people reviewing or editing content on behalf of others).
Hope this helps!
Ah, tnx. I was thinking in terms of that, but I’m too hooked in WordPress-terms.
Many thanks for this!
Regards John
Hi @hej !
Sure thing, always happy to help. And luckily, @pedro.carvalho explained solution way better than me