Skip to content

Commit

Permalink
Fixed #12944
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Mar 21, 2023
1 parent b5e752c commit 0633ce9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a bug where relation data was getting deleted when running garbage collection on PostgreSQL. ([#9905](https://github.com/craftcms/cms/issues/9905))
- Fixed a bug where Lightswitch fields’ “OFF Label” and “ON Label” settings weren’t getting translated. ([#12942](https://github.com/craftcms/cms/issues/12942))
- Fixed a bug where `craft\events\DefineUserContentSummaryEvent::$userId` was never set for `craft\controllers\EVENT_DEFINE_CONTENT_SUMMARY` events. ([#12944](https://github.com/craftcms/cms/issues/12944))
- Updated svg-sanitizer to 0.16. ([#12943](https://github.com/craftcms/cms/issues/12943))

## 3.8.4 - 2023-03-20
Expand Down
15 changes: 12 additions & 3 deletions src/controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1603,9 +1603,17 @@ public function actionUserContentSummary(): Response
{
$this->requirePostRequest();

$userIds = $this->request->getRequiredBodyParam('userId');
$userId = $this->request->getRequiredBodyParam('userId');

if (is_array($userId)) {
$userId = array_map(function($id) {
return (int)$id;
}, $userId);
} else {
$userId = (int)$userId;
}

if ($userIds !== (string)Craft::$app->getUser()->getIdentity()->id) {
if ($userId !== (int)Craft::$app->getUser()->getIdentity()->id) {
$this->requirePermission('deleteUsers');
}

Expand All @@ -1614,7 +1622,7 @@ public function actionUserContentSummary(): Response
foreach (Craft::$app->getSections()->getAllSections() as $section) {
$entryCount = Entry::find()
->sectionId($section->id)
->authorId($userIds)
->authorId($userId)
->site('*')
->unique()
->anyStatus()
Expand All @@ -1630,6 +1638,7 @@ public function actionUserContentSummary(): Response

// Fire a 'defineUserContentSummary' event
$event = new DefineUserContentSummaryEvent([
'userId' => $userId,
'contentSummary' => $summary,
]);
$this->trigger(self::EVENT_DEFINE_CONTENT_SUMMARY, $event);
Expand Down

0 comments on commit 0633ce9

Please sign in to comment.