-
Notifications
You must be signed in to change notification settings - Fork 293
Description
I'm using cakedc/users on a website where I don't need first names or usernames, I'm only using emails. That breaks $this->User->welcome() because it expects either first name or username:
users/src/View/Helper/UserHelper.php
Lines 130 to 137 in 9f9f49b
| $title = $identity['first_name'] ?? null; | |
| $title = $title ?: ($identity['username'] ?? null); | |
| $title = is_array($title) ? '-' : (string)$title; | |
| $label = __d( | |
| 'cake_d_c/users', | |
| 'Welcome, {0}', | |
| $this->AuthLink->link($title, $profileUrl) | |
| ); |
In my case, the above (predictably) outputs "*Welcome, *".
I acknowledge this is kind of an edge case because I had to specifically hack the Users table rules a little so that it doesn't require a username. But at the same time, I've seen other issues where people want to use email instead of username, and that has even made it into the docs.
So maybe the helper should default to email either if the config says the email is preferred, or if every other way to address the user is empty.