Skip to content

Commit

Permalink
patching the user group check if an attempt is made to create a new user
Browse files Browse the repository at this point in the history
  • Loading branch information
markmiddleton committed Dec 12, 2023
1 parent c5e73ec commit ade6c6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/AlgoliaSyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,14 @@ public function getEventElementInfo($element, $processRecords = true) {
// this will get the current user's groups (may be multiple indexes to update)
// lets only upsert records that match the configured groups in algolia sync
$algoliaSettings = AlgoliaSync::$plugin->getSettings();
$deleteFromAlgolia = false;

if (isset($algoliaSettings['algoliaElements']['user'])) {
$syncedGroups = $algoliaSettings['algoliaElements']['user'];

$userGroups = Craft::$app->userGroups->getGroupsByUserId($element->id);
$deleteFromAlgolia = true;

foreach ($userGroups AS $group) {
if (isset($syncedGroups[$group->id]) && $syncedGroups[$group->id]['sync'] == 1) {
$info['sectionHandle'][] = $group->handle;
Expand Down

0 comments on commit ade6c6c

Please sign in to comment.