sanity-plugin-created-by
v0.1.2
Published
Stores the user ID of the current user in. Nothing is displayed
Downloads
2
Maintainers
Readme
'Created By' Plugin
This plugin stores the user ID of the currently logged in user against a document.
NOTE: If adding to existing document, the user of the first person who accesses the document will be stored against it as the creator
This plugin has no visual display, it goes on behind the scenes.
To install, in the root of the Sanity Studio in the terminal:
sanity install created-by
Schema example:
fields: [
{
name: 'createdBy',
type: 'createdBy',
title: 'Created By'
}
]
You can then use it in the deskStructure using a GROQ query $identity:
...
S.listItem()
.title('My Content')
.child(
S.documentList()
.title('Content')
.menuItems(S.documentTypeList('content').getMenuItems())
.filter('_type == $type && createdBy == $identity')
.params({ type: 'content' })
),
...