Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
getUsername() is deprecated. It has to be replaced with getDisplayName()
For reference,
https://api.drupal.org/api/drupal/core!modules!user!src!Entity!User.php/...
I have provided the patch in which all getUsername() functions are replaced with getDisplayName()
Comment | File | Size | Author |
---|---|---|---|
#4 | 3037851-04-replace-getUsername.patch | 994 bytes | deepaligaurkar |
| |||
#2 | 3037851-02-replace-getUsername.patch | 1 KB | deepaligaurkar |
Comments
Comment #2
deepaligaurkar CreditAttribution: deepaligaurkar commentedPlease find attached patch.
Comment #4
deepaligaurkar CreditAttribution: deepaligaurkar commentedUpdated patch for the error.
Comment #5
deepaligaurkar CreditAttribution: deepaligaurkar commentedComment #6
LaravZ CreditAttribution: LaravZ at Ordina Digital Services commentedThanks for your work!
The patch applied cleanly to the latest dev and stable versions and does as stated by the deprecation instructions (Use \Drupal\Core\Session\AccountInterface::getAccountName() or \Drupal\user\UserInterface::getDisplayName() instead).
Comment #7
npralhad CreditAttribution: npralhad as a volunteer commentedThe patch in #4 worked perfectly on local environment.
Comment #8
deepaligaurkar CreditAttribution: deepaligaurkar commentedComment #10
BerdirThanks.
Comment #12
deepaligaurkar CreditAttribution: deepaligaurkar at Globant commented