Skip to content

Commit 52154d7

Browse files
committed
Invalidate user caches on activation/unlock/suspension/etc
Fixes #9947
1 parent 90913bb commit 52154d7

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixed
1010
- Fixed a bug where entry drafts weren’t getting propagated to other sites automatically after a section’s Propagation Method setting was changed. ([#9944](https://github.com/craftcms/cms/issues/9944))
11+
- Fixed a bug where user indexes weren’t immediately showing changes to users’ activation/suspension states. ([#9947](https://github.com/craftcms/cms/issues/9947))
1112

1213
## 3.7.16 - 2021-10-06
1314

src/services/Users.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,9 @@ public function activateUser(User $user): bool
669669
]));
670670
}
671671

672+
// Invalidate caches
673+
Craft::$app->getElements()->invalidateCachesForElement($user);
674+
672675
return true;
673676
}
674677

@@ -753,6 +756,9 @@ public function unlockUser(User $user): bool
753756
]));
754757
}
755758

759+
// Invalidate caches
760+
Craft::$app->getElements()->invalidateCachesForElement($user);
761+
756762
return true;
757763
}
758764

@@ -795,6 +801,9 @@ public function suspendUser(User $user): bool
795801
]));
796802
}
797803

804+
// Invalidate caches
805+
Craft::$app->getElements()->invalidateCachesForElement($user);
806+
798807
return true;
799808
}
800809

@@ -841,6 +850,9 @@ public function unsuspendUser(User $user): bool
841850
]));
842851
}
843852

853+
// Invalidate caches
854+
Craft::$app->getElements()->invalidateCachesForElement($user);
855+
844856
return true;
845857
}
846858

0 commit comments

Comments
 (0)