Filtering Collection items based on user

I have a CMS collection on the User Account page. Is there a way to filter the data to only show items of the current user?

Not statically.
You’d basically need to emit the entire list into the page, and then filter it with custom code.

Absolutely a bad idea if you have a ton of data, or if it’s even mildly sensitive user information.

Another approach is to sync your CMS to Airtable using e.g. Whalesync, and then build a simple API using e.g. to retrieve the Airtable data specific to that user. That’s much better, and less vulnerable, but still not a -secure- solution.

What about the following solution?
Create a CMS collection for the users.
Create a CMS collection that maps sensitive data to users (with a field of “username” or something).
Then. on the first CMS page, use a CMS collection component to retrieve the items from the second CMS that their "username’ matches “this” username.
Is that safe and a valid solution?

Unfortunately there is no “this” username.

  • User Accounts natively doesn’t offer any access to the logged in user info
  • Collection list filtering does not support dynamic filter values

If you had a collection list of all users, you could ref those data items to that users collection, so that viewing a user’s collection page would show only “their” items.

However there is no way to secure that page to an individual user. You can gate it to an access group, but everyone who is logged in has access to each other’s pages.