I’m trying to add a computed field to user pages in the Panel that calculates a sum from values in a structure field. The computed field looks like this:
balance_total:
label:
en: Balance Total
de: Guthaben Total
type: info
text: “{{user.balanceTotal}} Fr.”
I’ve implemented a UserModel following the documentation ( User models | Kirby CMS ), but the computed field only works correctly on my own user page in the Panel. When I view other users’ pages, the calculation isn’t performed for the displayed user.
How can I get the current user instance being displayed in the Panel so I can perform the calculation for that specific user, not just for the currently logged-in user?
If possible, I’d like to avoid creating a custom panel field as described here: Custom Panel field | Kirby CMS
Any guidance would be appreciated!