I just noticed that updates to a user do not bust the cache - with the new user fields this is something that I expected, as I now store some data there. I guess that problem is not new, I just encountered it for the first time with the custom fields in 2.2.
Luckily it’s an easy fix with the panel hooks:
<?php
$empty_cache = function($user) {
kirby()->cache()->flush();
};
kirby()->hook('panel.user.update', $empty_cache);
kirby()->hook('panel.user.delete', $empty_cache);
kirby()->hook('panel.avatar.upload', $empty_cache);
kirby()->hook('panel.avatar.delete', $empty_cache);
A question for people that use hooks more frequently than I do: Doesn’t it happen quite often that you execute the same code for at least two events (e.g. update and delete, or create and update)? Maybe the first parameter to the hook function could be an array of events:
kirby()->hook(
array(
'panel.user.update',
'panel.user.delete',
),
function() {...}
);