I need to show author details on a page.
Here is my typoscript to get the cruser_id of the page content:
20 = CONTENT
20{
table = tt_content
select{
selectFields = cruser_id
}
renderObj = COA
renderObj{
10 = TEXT
10{
required=1
field=cruser_id
}
}
}
How to get the username associated with the cruser_id?
As you didn’t specify the context of your code, here’s an example that just extends the code you provided.
EXPLANATION: You are fetching the content using the
CONTENTcObject and telling TYPO3 to render it asRECORDScObject. This object now has user’s UID available ascruser_idand can use it in its configuration using thesource.field.RECORDSthus loads the record (with UID = cruser_id) from thebe_userstable and you tell TYPO3 to render it as aTEXTcObject. As it can be any cObject (e.g. COA), the output can be more complex, including other fields from the backend user’s record.More complex example