Hello!
Long time reader, first time poster here
I have a Kirby setup with multiple users.
In one of my page templates, I added a “pageCreator” field which allows me to pick one of my users as the creator of the page - by default, whoever is logged into Kirby when the page is created:
fields:
pageCreator:
type: users
label: This is the page creator
multiple: false
default: true
This part seems to work well, I am able to see which user created each page, the user IDs are populated in the txt files, in the following format:
Pagecreator: - user://Ckh6rou8
Now I am trying to create Panel Blueprints for my Kirby Users. For each user, I want to include a table that lists the pages that were created by that user.
Here is what I have so far:
sections:
info:
type: info
text: "{{ user }}"
createdPages:
type: pages
parent: site
layout: table
query: site.index.filterBy("pageCreator",{{ user }})
The info section I’m starting with was added for a little debugging - and it successfully displays the ID for the user I am currently looking at.
The table, which should list pages filtered by that same user ID, does not work.
- As a test, using
query: site.index.filterBy("pageCreator","")
actually works, providing a list of dummy pages that have no creator. - As another test, manually typing in the User ID works, but only if I switch filtering methods - and shows pages created by the relevant user. As in:
query: site.index.filterBy("pageCreator","*=","THE USER ID FROM ABOVE")
No matter what I do, I can’t seem to get the user I am currently looking at into the query - I tried "{{user}}"
, user
, and a variety of other ideas - anything I try always returns an empty list.
I also tried reading the Filtering Collections page in the Cookbook, but could not figure out if the method shown there can be done from within yml files somehow.
Can you please help out?
Thank you!