Drupal 9 getUsername() deprecated

Created on 27 March 2021, over 4 years ago
Updated 30 June 2025, 12 days ago

When using the module in Drupal 9 we get the following error.

Error: Call to undefined method Drupal\user\Entity\User::getUsername() in Drupal\bulkemail\Form\MailForm->buildForm() (line 33 of modules/custom/bulkemail/src/Form/MailForm.php).

Change line 33: $name = $user->getUsername();
to
$name = $user->getDisplayName();

in
web/modules/bulkemail/src/Form/MailForm.php

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇩🇪Germany stevenx

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024