The pages I want to show are all of the same template. That template has a field user, that only contains one user.
Can I show all the pages related to a user in /panel/users/XYZabcde?
Here’s what I have in the user blueprint so far (showing all titel pages for that one specific user “GtpY9e9K” in all user accounts, of course):
You’ll probably have to move this to a user method or site method or so as the query language doesn’t support string concating. But I think user gives you the current user, while model gives you the user that you’re viewing in the query language.
Thank you, Nico. query: model.titelPages
doesn’t seem to return anything, though. Even if I delete the filterBy() part (or filter in Sonja’s suggestion), no pages show in the section.
(If I use query: user.titelPages, it indeed returns the pages of the user viewing the page. As you suspected.)
I tried as a user method and as a site method.
For the latter the problem seems to be getting the currently viewed user into the method dynamically, because if I hardcode a user ID into the site method (or into the call of the method), I get to see that specific user’s pages. query: site.titelPages(user.id) doesn’t work, as well as query: site.titelPages("{{ user.id }}").
For all I know, in the context of a pages section, model refers to the parent page object of the pages section, not to the user. So wondering if getting the currently selected user is even possible without some custom section
Sorry, that one does return the pages of the user viewing the account.
Getting dizzy here testing different combinations.
I don’t know, how to debug, what the method receives (other than seeing no pages returned).
What I do know is, that query: site.titelPages("XaYbZc") does work, but of course the section then shows user XaYbZc’s pages on every account page.
The method being:
A viable workaround for me would be, if I could add a kirby-panel-button (GitHub - moritzebeling/kirby-panel-button: Custom Kirby Panel button field to open or trigger URLs), that opened the titel page, with a search result on pages of the user.
Is there a way to trigger a panel page with search parameters, that are being applied to a section?
Like /pages/titel?section=list&q={{ user.id }}?
(That’s another unmanageable hurdle, right there, I guess?)
The query part does return the desired ID in this case. I tested.
You’re probably right here. I remembered another case where it was model = user viewed, user = current user. But might be different here in the pages section.
I’ll try to look closer into how one could get the user viewed (not current signed-in user).
Don’t know, why the filter(fn()) bit doesn’t work.
But with the above I get the desired pages on the user account pages!
(Downsides being: it looks a bit hacky—and it doesn’t work for the account page of the logged in admin, as that URL doesn’t contain the user ID. That I can totally live with, though.)
You guys are awesome.
Thank you for persisting and for bearing with me!