error loading user in code

Created on 7 November 2024, 26 days ago

Problem/Motivation

Error: Call to a member function load() on null in Drupal\social_private_message\Service\SocialPrivateMessageService->updateUnreadCount() (line 76 of /app/docroot/sites/social/modules/contrib/social_features/social_private_message/src/Service/SocialPrivateMessageService.php).

Steps to reproduce

Proposed resolution

Changed code in socialprivatemessage.php to:
$uid = $this->currentUser->id();
took this out

//$user_storage = $this->userManager;
//$user = $user_storage->load($uid);
replaced with this
$user = \Drupal\user\Entity\User::load($uid);

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

12.4

Component

Code (back-end)

Created by

πŸ‡ΊπŸ‡ΈUnited States dianacastillo Miami

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

Comments & Activities

Production build 0.71.5 2024