Why user methods cannot be extended?

The extensions section in the documentation explains how certain object methods, such as Page and File methods, can be extended via plugins. However, User object is not listed as extensible. I have a bunch of user-related methods, which I would like to declare as a plugin. Example:

site/plugins/usermethods/index.php:

<?php

Kirby::plugin('myplugins/usermethods', [
    'userMethods' => [
        'hello' => function() {
			return 'Hello ' . $this->username();
        }
	]
]);

Any controller/template:

<?= kirby()->user()->hello() ?>

Maybe a bit pointless example, but you get the idea. First I thought that this might be overlooked in the documentation, so I did test if this functionality was present, but it seems that this is not supported at least the way I assumed.

Of course a workaround is to define “static” functions in plugins which take the user object as a parameter. But at least in my opinion, it would be more consistent if user could also be extended with methods, like page and file objects.

Is it possible to define custom user methods in Kirby 3? If not, is there some technical limitation/motivation on why this is not implemented?

No, it is not possible. The possible extensions are defined here:

Why? Don’t know.

Bummer. Well, in any case, thanks for clarifying that :slightly_smiling_face:

I’d also find that useful, just saying (:

I created a new issue in the ideas repo (looks as if the original issue disappeared)

Upvote if you want this feature.