1

I have a remote app that enables preview based on your editor craft account. I want to retrieve draft entries that they are working on, but i cant find a way to do this. 'authorId' seems to always be the original author of the entry, rather than the draft.

Here is the important bit of my code ->

$user = Craft::$app->users->getUserByUsernameOrEmail($userp);

           return [
          'elementType' => Entry::class,
          'paginate' => false,
          'pretty' => true,
          'criteria' => ['draftId' => $entryId, 'section' => 'cashwrap', 'drafts' => true, 'orderBy'   => 'dateUpdated desc', 'authorId' => $user->id, 'limit' => 10 ],

I cant find any ref for retrieving, or filtering by the draft author id? The above will only show drafts for original author id not draft author.

1

I think i have found the answer after digging in Element docs... looks like this works! in criteria

'draftCreator' => $user->id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.