My project requires a notifications area. I want to list all notification entries that were created by currentUser or sent to currentUser.

I can do created by = craft.entries().section('thename').authorId(currentUser.id).all()

I can do sent to = craft.entries().section('thename').relatedTo({ targetElement: currentUser, field: 'thefield' }).all()

But is there a single query that will get both?


A blanket relatedTo query should do the trick.


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.