Short getter for user name?

Am I missing something or there are only methods for getting the first and the last name of the user, as well as his username?
I know I can easily do some checks like “if there is at least first name use it, and if there is last name add it, otherwise use the username”, but wouldn’t it be great if there’s a built-in method for that?

There is no built-in method for that and you can’t have custom user methods, either. But you can of course create a custom function in /site/plugins.

1 Like

I mean isn’t it helpful is this is built-in the core, alongside firstName(), lastName() and username()? :slight_smile:

Sure, that would be very helpful, as devs need it all the time. But in the absence of such a method, we have to be creative (and create feature wishes on GitHub) :wink:

1 Like

The solution depends on the language, in German I would use the last name, in USA it would be the first name I guess, in other languages it may be something else…

Nothing for Kirby as standard I think…

And there is another issue in this forum to delete the fields firstname and lastname in every account,
I agree to this because of the German law (called Datenschutz and Datensparsamkeit) and of other languages with more names or another understanding of this two fields,…

look at Custom user form fields for more

Well, first of all, these fields are optional, and then it depends on your use case whether or not you want or even have to use them. If you save customers as users, for example, you will need their names in any case. Does not really make sense to send a parcel and bill to Joe.

But I agree, names are not used in the same way in every culture.

1 Like