public function JanrainUserProfile::getUsername in Janrain Registration 8
Returns the name of a user.
Return value
string Returns the "Alfred Hitchcock" if first and last name specified, the "Alfred" - first name specified, "Hitchcock" - last name specified, "alfred.hitchcock@example.com" if no names exist.
File
- src/
User/ JanrainUserProfile.php, line 112
Class
- JanrainUserProfile
- The user profile on Janrain.
Namespace
Drupal\janrain_capture\UserCode
public function getUsername() : string {
$first_name = $this
->getFirstName();
$last_name = $this
->getLastName();
// The first and last name specified. Split them by a single space.
if ($first_name !== '' && $last_name !== '') {
$first_name .= ' ';
}
// Use an email as a username if neither first nor last name specified.
return $first_name . $last_name ?: $this
->getEmail();
}