Skip to content

Commit

Permalink
Merge pull request #39 from brilliancenw/develop-4
Browse files Browse the repository at this point in the history
patching the user group check if an attempt is made to create a new user
  • Loading branch information
markmiddleton authored Dec 12, 2023
2 parents c5e73ec + ade6c6c commit b93bfd6
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 b93bfd6

Please sign in to comment.