Skip to main content

Event visibility, archive and registration rules

This document states the conditions that decide three things about an event:

  1. Displayed — a viewer sees the event in a hub's event list, a calendar widget, the mobile app, or another list.
  2. Archived — the event appears in the hub's Archive list.
  3. Open to registration — the event page shows a working registration button.

There is no single rule for any of these. Each surface (PHP hub page, management-webapp grid, with-calendar widgets, mobile, and more) applies its own conditions, and some surfaces read MySQL while others read a Mongo copy. This document lists the rule per surface, the data each rule reads, when that data changes, and where the surfaces disagree.

This document describes the code at the commits in Version. The rules change when that code changes, so check for changes before you rely on a rule.

Version​

  • Written: 2026-09-24.
  • Code: every rule was read from the commits below. The file names and function names in this document refer to these commits.
  • Runtime facts: the hourly sweep status and the deploy tags come from Grafana Loki and GitHub tags, read on 2026-09-23.
RepositoryBranchCommitCommit date
backend-servicesdevelopa24648ebc2026-09-23
superco-consumerdevelopebaf9975f2026-09-22
management-webappdevelop52b638422026-09-22
with-calendarmasterb5ac01d2026-09-17
superco-managementdevelopfbf2727c2026-07-26
organization-dashboarddevelop6571eea7b2026-09-22
sqs-consumermastere0a8ab02026-09-15
consumer-mobilemaster11460f12026-09-02

Code is not the same as production​

This document describes source code, not deployments. Each environment (IL, FR, US; staging and prod) runs the version its last deploy tag points to. That version can be older or newer than the commits above. To predict what one environment does, find the commit its deploy tag points to. Then check whether the changes below are included in that commit.

Changes after these commits​

Merged changes that affect this document and that the rules below do not include yet:

RepositoryCommitChangeAffected sections
backend-servicese548f9531 (develop, 2026-09-23)The sync now stores isExpired = ended, whatever closeIfExpired says. The sync and the hourly sweep then write the same value.Input fields (isExpired row), Known inconsistencies item 1, and the readers that use isExpired without closeIfExpired (public event filters, RSS, facets). With this change, these readers always hide an ended event, and do not wait for the sweep.
sqs-consumerc810d0c (master)Sends the renamed sweep RPC.When the data changes, sweep status. The sweep works in each environment where this commit is deployed.

Open pull requests that will change this document when they merge:

  • backend-services #3389 and organization-dashboard #1219 (draft on 2026-09-24): add the Displayed in Hub, Displayed in Archive and Open To Registration flags to org-dashboard Event Details. When they merge, add their rule to the organization-dashboard section.

Check for changes​

This script lists the commits that changed the code this document describes, from the commits in the table to the current branch heads. Run it from the folder that contains the repository clones. If a repository prints commits, re-read the affected sections against the new code.

check() {
repo=$1; sha=$2; branch=$3; shift 3
git -C "$repo" fetch -q origin "$branch"
echo "== $repo ($sha..origin/$branch)"
git -C "$repo" log --oneline "$sha..origin/$branch" -- "$@"
}
check backend-services a24648ebc develop \
libs/utils/event-closure.util.ts libs/utils/vector-search.utils.ts libs/helpers/groups/group-approval-status.helper.ts \
apps/vector-search/src/query-builders apps/vector-search/src/aggregations apps/vector-search/src/utils \
apps/vector-search/src/search apps/groups/src/groups/queries/get-resources.queries.ts \
apps/groups/src/recurring-resources/recurring-resources.services.ts apps/groups/src/groups/groups.service.ts \
apps/groups/src/groups/groups-attributes.service.ts \
apps/external-gateway/src/controllers/registration-shared \
apps/organizations-stats/src/resources-stats/collectors/resources-stats-collector.service.ts
check superco-consumer ebaf9975f develop \
models/Groups.php models/Communities.php models/ApprovalStatuses.php models/View/GroupsList \
models/View/GroupsPageViewModel.php models/View/components/GroupActionButtons.php \
controllers/GroupsController.php controllers/SubscriptionsController.php domain/UserAccessChecker.php \
components/helpers/CommunitySettings.php jobs/UpdateResourceApproval.php jobs/RegisterBundledEvents.php \
modules/api/v1/models/ApiResource.php
check management-webapp 52b63842 develop \
src/stores/event-grid.store.ts src/stores/events-calendar.store.ts src/http-client/event-grid.client.ts \
src/components/event-grid/event-grid-header src/components/events-calendar/events-calendar-header
check with-calendar b5ac01d master \
src/providers/calendar-widget-provider/hooks/use-calendar.ts src/providers/app-provider/hooks/use-app-client.ts \
src/components/calendar-settings/utils.ts
check sqs-consumer e0a8ab0 master src/vector-search src/utils/config/cronjobs.config.ts src/cronjobs
check superco-management fbf2727c develop src/app/events
check organization-dashboard 6571eea7b develop src/components/community-events-table src/stores/community-events.store.ts
check consumer-mobile 11460f1 master lib/pages/item_page.dart

A listed commit does not always change a rule. For example, a search-ranking change can touch apps/vector-search/src/search and leave every visibility condition as it is.

To update this document:

  1. Re-verify the affected sections against the new code.
  2. Rewrite each affected section so that it states the new behaviour.
  3. Update the commit table and the Written date.
  4. Remove the rows in Changes after these commits that the new commits include.

How to use this document​

  • To answer "why is event X not shown in hub Y?": find which renderer hub Y uses (Which hub renderer), then read that surface's rule in Displayed. Use the QA queries to read the event's real state.
  • To predict the result of a test case: use the scenario table. Each row is one event state; each column is one surface.
  • Before you change a rule: read Known inconsistencies. Several surfaces copy the same rule with small differences, and a change in one place does not reach the others.

Repository short names used below:

Short nameRepositoryRole
PHPsuperco-consumerLegacy PHP/Yii2 consumer site: hub pages, event page, registration
BEbackend-servicesNestJS backend: vector-search (Mongo), groups, gateways
MWmanagement-webappEvent grid iframe (/event-grid), events calendar
WCwith-calendarEmbeddable calendar widgets (GRID, CAROUSEL, FULL, LITE)
SMsuperco-managementAdmin events table (co-experience / who-is-in)
ODorganization-dashboardOrganization dashboard (Community Events, stats)
SQSsqs-consumerCron jobs, including the hourly vector-search sweep
MOBconsumer-mobileFlutter consumer app

Code pointers use REPO path → symbol. Line numbers are not given, because they change often.

Terms​

TermMeaning
EventOne row in MySQL groups. Each occurrence of a recurring event is its own row.
HubA community whose page lists events (communities.id). One event can be linked to many hubs.
Hub linkThe (hub, event) pair: one row in communities_groups (unique on community_id, group_id). Approval is stored per hub link.
Origin hubThe hub where the event was created: groups.original_community_id.
Shared-in linkA hub link whose hub is not the origin hub.
Cross-org shareA shared-in link whose hub belongs to a different organization than the event.
ConnectorA groups row that represents a sub-community, not an event: parent_community_id IS NOT NULL.
Legacy hubA hub page rendered by PHP from MySQL. This is the default.
Grid hubA hub page that embeds the MW /event-grid iframe, which reads Mongo.
Mongo documentThe event's document in Mongo collection vector-search-resources, keyed by (organizationId, resourceId). organizationId is the event's own organization.
ClosedThe canonical closure rule. See Closed.
Endedends_at is set and in the past. PHP calls this getIsExpired(). It is independent of the closure fields.

Approval statuses​

Table approval_status, referenced by communities_groups.approval_status_id.

IdNameOccurs on event hub links
1PendingYes
2Auto ApprovedYes
3Approved by AdminYes
4Approved by PasswordNo (members only)
5RejectedYes
6BannedNo
7EndedNo
8Pending Origin ApprovalYes. A shared-in link waits for the origin hub to approve the event.
9DeletedNo
10PlaceholderYes. An unfinished facility-booking draft.
11Auto RejectedNo
12Rejected by AdminNo
13–15Residency statusesNo
16Approved via Trusted HubCode constant only (BE libs/enums/approval-status.enum.ts). No table row, so the foreign key does not allow it on communities_groups.

NULL is possible after the referenced status row is deleted (ON DELETE SET NULL), or for a new share before its approval job runs.

Input fields​

Every rule in this document is built from these fields.

ConceptMySQLMongo vector-search-resourcesNotes
Closed manuallygroups.closed tinyintNo document. A manual close deletes the Mongo document (see Freshness).Set by the admin Close action, the consumer "Delete" button (a soft close), org-dashboard batch close, the recurring reschedule, and PHP API v1. Nothing sets it when a date passes.
Close dategroups.close_at TIMESTAMP, UTCcloseAtCompared with the current time on every read.
Close when ended ("auto-close")groups.close_if_date_expired tinyintcloseIfExpiredOn INSERT, PHP defaults it from the hub option default_close_if_expired, and forces 0 when close_at is set. Updates are not guarded, so an edited event can have both.
Endgroups.ends_at bigint, unix secondsendsAtAn event with no ends_at never ends.
Startgroups.starts_at bigint, unix secondsstartsAtUsed only by date windows.
Publish dategroups.published_at TIMESTAMPpublishedAtNULL means published now. A future value hides the event from lists.
Privategroups.is_private tinyintisPrivateEvent
Approval in a hubcommunities_groups.approval_status_idapprovedCommunities (hubs with status 2 or 3), pendingCommunities (1), rejectedCommunities (5)Any other status (4, 8, 10, NULL, …) is in no Mongo array.
Registration togglegroups.subscribe_enabled tinyint, NULL = offnot stored
Registration windowgroups.subscribe_enabled_at, groups.close_subscribe_enabled_at int, unix secondsnot storedWhen subscribe_enabled_at is set, it replaces the toggle.
External registration linkgroups.data_linkexternalJoinUrlWhen set, the event page shows an external "Join" button instead of the registration flow.
Capacitygroups.max_members, subscriber counts, ticket quotasmaxMembers only"Full" is computed per request.
Hub rendereroptions row with `key` = 'iframe_events_grid_enabled'not storedSee Which hub renderer.
Org archive switchorganizations.is_archive_shownnot storedControls only whether MW shows the Archive button.
Derived: isExpirednoneisExpiredDo not use this field to mean "ended". Its value depends on which writer ran last. See Known inconsistencies, item 1.
Derived: Mongo closednoneclosedBecause manually closed events have no document, closed: true in practice means "closed by close_at or by auto-close".

Building blocks​

Closed​

The canonical rule. The first matching line decides:

  1. closed = 1 → closed (manually).
  2. close_at is set → closed if close_at is in the past, otherwise open. close_if_date_expired and ends_at are ignored.
  3. close_if_date_expired = 1 and the event has ended → closed (auto-closed).
  4. Otherwise → open.

Rule 2 is called close_at wins: a future close_at keeps the event open, even when auto-close is on and the event has ended.

An open event can be ended. For example, an event with close_if_date_expired = 0 and no close_at stays open for ever after it ends.

Implementations of this rule:

  • PHP models/Groups.php → Groups::isClosed() (the owner of the rule)
  • BE libs/utils/event-closure.util.ts → resolveEventClosure(), isEventClosed(), buildEventClosedSql() (SQL form)
  • The legacy hub SQL: PHP models/View/GroupsList/GroupsList.php → getCommonGroupsListCondition() and PHP models/Communities.php → getActiveGroups()

The Mongo predicates do not follow rule 2. See Known inconsistencies, item 2.

Approved​

"Approved" means a different set of status ids in different code:

CodeApproved set
PHP (ApprovalStatuses::APPROVED_STATUSES)2, 3, 4, 16
BE helper, org-dashboard filters, registration eligibility, monthly stats2, 3, 4
Mongo approvedCommunities, many BE group paths2, 3

Only 2 and 3 occur on event hub links today, so the three sets give the same result for events. If an event link ever gets status 4 or 16, the surfaces will disagree.

Published and private​

  • Published: published_at IS NULL or in the past.
  • Private: is_private = 1.
  • The legacy hub has one exception: when published_at is set, it replaces the private check. The expression is IF(published_at IS NULL, NOT is_private, published_at < NOW()). Every other surface hides private events whatever published_at says.

Registration window open​

PHP models/Groups.php → Groups::isSubscriptionEnabled():

  • Started: if subscribe_enabled_at is set, it must be in the past; otherwise subscribe_enabled = 1.
  • Not stopped: close_subscribe_enabled_at is not set, or is in the future.
  • Window open = started AND not stopped.

Which hub renderer​

A hub page uses one of two list implementations:

  • Legacy hub (default): PHP builds the list from MySQL.
  • Grid hub: the page embeds the MW /event-grid iframe, which reads Mongo. This happens when the option iframe_events_grid_enabled resolves to 1 for the hub (PHP components/helpers/CommunitySettings.php → isNewGridEnabled()). The option resolves from the hub's own row, then from the language default row (community_id = 0).

The two renderers apply different rules. Only grid hubs have an Archive.

Pages that are not hub pages (the related-events panel on the event page, My Events, Saved Events) always use the PHP MySQL lists.

Displayed​

Legacy hub list (PHP, MySQL)​

Code: PHP models/View/GroupsList/GroupsList.php → getCommonGroupsListCondition(), the panel classes in the same folder (RegularGroupsList, CheckingGroupsList, DateBasedGroupsList, SubCommunitiesList), and PHP models/Communities.php → getGroups().

Conditions for every viewer:

  • The event has a hub link to this hub, and the link status is not 8 and not 10. (SQL != also drops NULL.)
  • closed = 0.
  • Close_at wins: IF(close_at IS NOT NULL, close_at > NOW(), close_if_date_expired = 0 OR ends_at IS NULL OR ends_at > UNIX_TIMESTAMP()).
  • The regular and checking panels need the matching type_id and parent_community_id IS NULL. Connectors are listed in a separate sub-communities panel.
  • The calendar view also needs starts_at IS NOT NULL.
  • If the hub option close_group_on_full_regular (or _checking) is on, full events are removed.

There is no start-date window and no organization filter. So:

  • Cross-org shares and events with no organization are listed.
  • An ended event with close_if_date_expired = 0 stays listed, sorted last with an "expired" badge.

Conditions that depend on the viewer:

ViewerExtra conditions
GuestPublished-or-not-private expression (Published and private) AND status IN (2, 3, 4, 16).
Logged-in member (not a hub admin, no resource.view_all_events)(Own event OR the published expression) AND (own event OR status IN (2, 3, 4, 16)). A member sees their own pending and private events.
Hub admin or resource.view_all_events holderNo publish, private or approval condition. The hub options default_admin_view.private and default_admin_view.statuses can add filters.

Grid hub (MW /event-grid, Mongo), regular viewer​

Endpoints: GET organizations/:org/communities/:cid/resources/published (guest) and /available (logged in). Both use variant=GRID.

Code: BE apps/vector-search/src/aggregations/calendar-get-match.ts → getBaseMatchQueryForRegularUsers(), BE apps/vector-search/src/query-builders/vector-search.query-builder.ts → visibleToRegularUsers(), closed(), isPrivateEvent(), afterPublished().

All conditions must hold:

  • A Mongo document exists for the event. Manually closed events have none.
  • organizationId = the hub's organization. Cross-org shares never match.
  • approvedCommunities contains the hub (status 2 or 3).
  • closed = false.
  • closeIfExpired = false OR isExpired = false.
  • closeAt is NULL OR in the future.
  • isPrivateEvent != true.
  • publishedAt is NULL OR in the past.
  • startsAt is NULL OR on/after 2023-01-01. The grid sends this fixed floor, so ongoing events, undated events and ended events with auto-close off stay listed.
  • Restricted hubs return nothing to members who are not approved, unless the hub allows showGroupsInRestrictedCommunities.

Not checked: full events, connectors (they are indexed as subcommunity and are not excluded here).

Grid hub, admin status tabs​

Shown to hub admins, leaders and canViewAllEvents holders. Code: BE apps/vector-search/src/aggregations/calendar-get-match.ts → matchAvailableCommunityResources(); tabs in MW src/components/event-grid/event-grid-header/event-grid-header.tsx.

TabCondition
ACTIVEApproved in the hub AND not private AND published AND the closed(false) conditions above
PENDINGpendingCommunities contains the hub (status 1 only; status 8 is in no tab)
REJECTEDrejectedCommunities contains the hub (status 5 only)
PRIVATEisPrivateEvent = true AND publishedAt is NULL. A private event with a publish date is in no tab.
WAITING_FOR_PUBLISHpublishedAt in the future

Leaders see their own pending or approved events, plus public approved published events.

with-calendar widgets (WC, Mongo)​

Endpoint: GET organizations/:org/calendar/resources. Responses are cached in Redis for 5 minutes.

Code: BE apps/vector-search/src/aggregations/calendar-get-match.ts → getBaseMatchQueryForRegularUsers(), getDateRangeFilter().

Base conditions (all widget types):

  • Approved in one of the calendar's configured hubs, or in any hub when none are configured.
  • resourceType is regular or checking. Connectors are excluded.
  • The same closure, private and publish conditions as the grid hub.

Date window:

WidgetWindow
GRID, CAROUSELstartsAt is NULL OR startsAt ≥ the start floor. The floor is the configured start date, or now. An event disappears from these widgets once it has started.
FULL, LITEstartsAt in the shown range, OR the event spans the range, OR (startsAt and endsAt are both NULL AND closeAt is in the future). Undated events without a future closeAt are hidden.
Schedule dotsAlso need startsAt set.

Known issue (CU-123ztrcvt1h): for GRID and CAROUSEL the start floor is shifted by the organization's UTC offset. For an organization in America/Phoenix, an event that starts in the next 7 hours is already missing from the widget.

Event page by direct URL (PHP)​

Code: PHP controllers/GroupsController.php → actionView(), PHP domain/UserAccessChecker.php → canViewGroup().

  • The event is loaded through the hub in the URL (getGroups()). If the hub link is missing or has status 8 or 10, every viewer, including super admins, is redirected to the hub with the message "We are sorry but the page you were trying to reach is not available."
  • If the event is private, or not approved in this hub (2, 3, 4, 16), only super admins, hub admins, the event's admins and resource.view_all_events holders can open the page. Everyone else is redirected with the same message.
  • A future published_at does not block the page, because of a bug in Groups::isPublished() (see Known inconsistencies, item 8).
  • Closed, ended and full events are not blocked. They only change the buttons.

consumer-mobile and leaders-app (MySQL)​

  • consumer-mobile list and search (GET /communities/:cid/groups?filterBy[closed]=0&filterBy[isPrivate]=0): closed = 0 AND is_private = 0 AND (close_if_date_expired = 0 OR ends_at ≥ now) AND status IN (2, 3, 4). close_at and published_at are ignored.
  • consumer-mobile event page: loaded by id with no visibility check.
  • leaders-app events list: status IN (2, 3, 4) AND closed = 0 AND is_private = 0 AND not a connector. No date check at all (ends_at, close_at, published_at are ignored).

AI search, public event detail, RSS, calendar filter facets (Mongo)​

  • Public event filters (BE apps/vector-search/src/utils/public-event.filters.ts → getPublicEventFilters()): closed = false AND isExpired = false AND not private AND (closeAt NULL or future). No publish check. Approval is checked only when hub ids are given.
  • RSS ACTIVE_EVENTS: closed = false, isExpired = false, not private, approved in any hub. The TEN_LATEST and month modes apply no visibility filter.
  • Calendar filter facets: closed = false, isExpired = false, isPrivateEvent = false.
  • These readers use isExpired without closeIfExpired, so an ended event with auto-close off is hidden here after the hourly sweep but shown in the grid hub.
  • getOpenRegistrationFilter() checks only closeAt, despite its name.

superco-management events table​

Data from PHP API v1 ({coexperience|whosin}/list).

  • Rows: the hub's events from getGroups() (status 8 and 10 hidden), excluding connectors.
  • Status column: PHP models/Groups.php → Groups::getClosedStatus(). The first match decides:
    1. Auto closed: close_if_date_expired = 1 AND ended. This is checked before close_at, so it differs from the canonical rule.
    2. Closed: the canonical rule says closed (manual or past close_at).
    3. Expired: ended, not closed.
    4. Full: the origin hub closes on full AND the event is full.
    5. Active.
  • Admins can switch only between Active and Closed, by writing closed. Switching Closed → Active cannot reopen an event whose close_at has passed.

organization-dashboard​

  • Community Events → Event Details lists every hub link where the hub is the selected hub AND groups.organization_id is the dashboard organization. With no filter, it lists closed, private, pending, rejected, status 8, 10 and NULL rows, and connectors. Cross-org shares and events with no organization are not listed.
  • Stats tab, Events page, Reports ("Active" column, "Event Status" filter) read Mongo monthly-resources-stats. isActive = not closed manually AND not private AND (close_if_date_expired = 0 OR ends_at NULL OR ends_at in the future) AND approved (2, 3, 4) in any hub. It ignores close_at and published_at. The value is recomputed only after the event or its subscribers change, never because a date passed.

Archived​

Grid Archive (the ARCHIVED toggle in MW /event-grid)​

This is the only list that shows archived events on their own.

When it exists:

  • Only on grid hubs. Legacy hubs have no archive.
  • MW shows the button only when organizations.is_archive_shown = 1. The backend does not check this switch.
  • Only regular events (EventGridTypeEnum.REGULAR) are fetched.

Conditions (BE apps/vector-search/src/aggregations/calendar-get-match.ts → matchArchivedResources(), vectorSearchArchivedEventsMatch()):

  • A Mongo document exists. Manually closed events have none, so manually closed events are never in the Archive.
  • organizationId = the hub's organization AND approvedCommunities contains the hub.
  • closed = true OR (isExpired = true AND closeIfExpired = true).
  • isPrivateEvent != true.
  • No publish check and no date window.

Consequences:

  • An event closed by close_at enters the Archive only after the Mongo document gets closed = true. That happens at the next resync of the event or at the hourly sweep. Until then, the event is in neither the hub nor the Archive.
  • An ended event with auto-close on enters the Archive after the sweep or a resync sets isExpired = true.
  • An ended event with auto-close off is never archived. It stays in the hub.
  • An event with a future close_at, auto-close on, and a past ends_at is archived, although the canonical rule says it is open.

Events calendar "Show archived events" (MW)​

A checkbox in the MW events calendar (MW src/components/events-calendar/events-calendar-header/events-calendar-header.tsx). It sends isArchivedIncluded: true, which removes the closure conditions but keeps approved, not private and published. Closed events are mixed in with live events. The is_archive_shown switch does not apply. Manually closed events still do not appear, because they have no Mongo document.

Open to registration​

The registration button appears only on the event page. Lists, widgets and grid cards have no button.

Consumer event page, logged-in viewer​

Code: PHP models/View/GroupsPageViewModel.php → getActionButtons(). The first matching step decides:

  1. Restricted hub view → the restricted rules (next section).
  2. Status 5 (Rejected) → no buttons. Status 1 (Pending) → an Approve button for approvers only. Other statuses fall through; non-admins cannot open the page for them anyway (Event page).
  3. The event is sold through a bundle → "Register through the bundle" redirect.
  4. data_link is set → an external "Join" button. No other checks, so it shows even when the event is closed or ended.
  5. Registration window not open → no button.
  6. The viewer has an unpaid order → a "Pay" button (also after the event ended).
  7. Closed OR ended → a disabled button. The label is the hub option group_expired_regular_text / group_expired_checking_text, default "Time is up!".
  8. Already registered → cancel, or register again when multi-registration is on. Per-user maximum reached → "maxed" state.
  9. Full (capacity or a mandatory sold-out ticket) → a waitlist button, or "Full".
  10. Waitlist priority lock → blocked.
  11. Otherwise → the registration button.

Consumer event page, guest or restricted viewer​

Code: PHP models/View/GroupsPageViewModel.php → getGuestActionButtons().

  1. Not approved in this hub (2, 3, 4, 16), or a restricted hub and the viewer is not an approved member → no buttons.
  2. Bundle redirect; then data_link → "Join" (also when closed or ended).
  3. Closed OR ended → the disabled "Time is up!" button. Here this check comes before the registration window.
  4. Full → waitlist or "Full".
  5. Registration window open AND the viewer may register → the registration button. Guests cannot register on hubs with is_approved_members_only.

Event-level summary​

For a viewer who is allowed to register, the event is open to registration when all of these hold:

  • approved in the viewing hub;
  • not sold through a bundle;
  • data_link is empty (otherwise the event shows "Join" instead);
  • the registration window is open;
  • not closed (canonical rule);
  • not ended;
  • not full.

Per-viewer conditions come on top: logged in, not banned, approved member on restricted hubs, not already registered, per-user maximum, no unpaid order, waitlist priority, age limit.

Server-side checks​

The server checks are weaker than the buttons. A direct request can succeed where the page shows no button.

EndpointChecksDoes not check
PHP POST /site/groups/users-subscribe (GroupsController::actionUsersSubscribe())Registration window, not closed, approved in the hub (2, 3, 4, 16), approved member on restricted hubs, duplicates and unpaid orders, capacity (waitlist bypass), priority lock, per-user max, agePlain ends_at (only through the auto-close rule), is_private, published_at, data_link, bundle
PHP jobs/RegisterBundledEvents.phpSame as users-subscribeSame gaps
PHP subscribe modal and form loaders (SubscriptionsController::actionGetSubscribeModal() and related)Closed OR ended, capacity (unless invited), priority lock, can('subscribe')
PHP subscribe after login (GroupsController::actionSubscribeAfterLogin())The event is linked to the hub. The data_link branch saves the registration with no other check; the other branch checks closed OR ended.Approval and closure on the data_link branch
PHP subscribe external (GroupsController::actionSubscribeExternal())Only that the hub link is not 8 or 10Access control, approval, closure, ended, registration window, whether data_link is set
BE POST resources/:id/registration and registration-form (registration-eligibility.service.ts → RegistrationEligibilityService). Used by the MW /registration form, the consumer ?registrationBackdoor=true flow and consumer-mobile.subscribe_enabled, closed, the hub link status IN (2, 3, 4), waitlist or ticket quota full, per-user checksclose_at, close_if_date_expired, ends_at, the registration window, max_members, mandatory tickets, private, published

consumer-mobile​

The mobile event page always shows a Register button. It opens the web event page with ?jwt=, so the web rules above apply.

When the data changes​

DataRefreshed byDelay
MySQL fieldsDirect writes. Time-based states are computed on every read.None
Mongo documentThe RESOURCE_UPDATED event on Redis stream groups-channel, published by PHP saves and by backend hub-link writes. The sync rewrites the whole document.Near real time
Mongo document of a closed eventA manual close through closeResourcesByIds or closeSubcommunity deletes the document. The sync reads only rows with closed = 0, so the document comes back only after a reopen.Immediate
Mongo approval of shared-in links after the origin approval changesPHP queue jobs (GroupAfterSaveActions → UpdateResourceApproval per shared hub), then a syncQueue delay
Mongo isExpired and closed for passed datesThe hourly SQS cron vectorSearch.syncVectorSearchResources: sets isExpired = true for every document whose endsAt passed, and closed = true once closeAt passed.Up to 1 hour
monthly-resources-stats isActiveMarked dirty on RESOURCE_UPDATED / SUBSCRIBER_UPDATED, recomputed by a per-minute cycle10–25 minutes after an edit. Never because a date passed.
with-calendar responsesRedis response cacheUp to 5 minutes

Closes that change only MySQL and leave a stale Mongo document with closed: false:

  • the recurring series reschedule (BE apps/groups/src/groups/groups.service.ts → closeManyGroupsIds()), for example when a series goes from 10 dates to 8;
  • PHP API v1 closedStatus / isClosed saves (superco-management Status edits).

A later sync cannot repair these documents, because the sync skips closed rows. The event stays in the grid hub and the widgets until its old closeAt or endsAt passes and the sweep runs.

Hourly sweep status on 2026-09-24: the sweep fails in FR prod and FR staging since 2026-09-17 ("There is no matching message handler defined in the remote service."). The likely cause: backend PR #3339 renamed the RPC, and the sqs-consumer version deployed there still sends the old name UPDATE_CLOSE_IF_EXPIRED_RESOURCES. The fix (sqs-consumer commit c810d0c) is deployed in US prod only. While the sweep fails, events closed by close_at never reach the Archive unless they are resynced. The first successful run repairs every document.

Scenario table​

Base event: approved (2 or 3) in the hub, public, published, open, starts in the future, registration window open, no data_link, not full. Each row changes only what it names.

Columns:

  • Legacy hub: guest or regular member on a legacy hub.
  • Grid hub: regular viewer on a grid hub.
  • Archive: the grid Archive (org is_archive_shown = 1).
  • Widget: with-calendar GRID or CAROUSEL.
  • Page: a non-admin opens the event page by URL.
  • Button: what a logged-in, eligible member sees on the page.
#Event stateLegacy hubGrid hubArchiveWidgetPageButton
1Base eventYesYesNoYesOpensRegister
2Started, not endedYesYesNoNoOpensRegister
3Ended, auto-close off, no close_atYes, last, "expired" badgeYesNoNoOpens"Time is up!"
4Ended, auto-close on, no close_atNoNo after a resync or sweep; Yes beforeYes after a resync or sweep; No beforeNoOpens"Time is up!"
5close_at passedNoNoYes after a resync or sweep; No beforeNoOpens"Time is up!"
6close_at in the future, auto-close on, endedYesNo after a resync or sweep; Yes beforeYes after a resync or sweep; No beforeNoOpens"Time is up!" (ended)
7close_at in the future, not endedYesYesNoYesOpensRegister
8Closed manually (admin Close, consumer Delete, batch close)NoNo (no document)No (no document)NoOpens"Time is up!"
9Closed by a recurring reschedule or superco-management Status editNoYes (stale document)NoYes (stale document)Opens"Time is up!"
10Private, no published_atNo (member: only own events)NoNoNoRedirect—
11Private, published_at in the pastYesNoNoNoRedirect—
12published_at in the futureNoNoNoNoOpens (bug)Register
13Pending (1) in this hubNo (member: only own events)No (admin PENDING tab)NoNoRedirect—
14Rejected (5) in this hubNoNo (admin REJECTED tab)NoNoRedirect—
15Pending origin (8) or Placeholder (10)No, also for adminsNo, in no admin tabNoNoRedirect for everyone—
16Shared into a hub of another organization, approvedYesNo (document keyed by origin org)NoNoOpensRegister
17FullNo if the hub option close_group_on_full_<type> is on; otherwise YesYesNoYesOpensWaitlist or "Full"
18data_link setYesYesNoYesOpens"Join", also when closed or ended
19Registration toggle off (subscribe_enabled 0 or NULL), no windowYesYesNoYesOpensNone
20subscribe_enabled_at in the future, or close_subscribe_enabled_at passedYesYesNoYesOpensNone
21No starts_at and no ends_atYes (not in the calendar view)YesNoYes (GRID/CAROUSEL); FULL/LITE only with a future close_atOpensRegister
22Connector (parent_community_id set)In the sub-communities panelNot excluded by the queryNoNon/an/a
23No Mongo document (for example created_by NULL, or the org mapping is missing)YesNoNoNoOpensRegister

Notes:

  • Rows 4, 5 and 6 depend on the Mongo freshness rules in When the data changes.
  • Row 6 exists only for edited events, because an INSERT with close_at forces auto-close off.
  • Row 12: a future publish date never blocks the event page, so a user with the URL can register.
  • Rows 3 and 19–20: a direct POST /site/groups/users-subscribe still accepts a registration for row 3, and for private events (row 10), because the server does not check plain ends_at or is_private.
  • Hub admins and resource.view_all_events holders see more on the legacy hub (rows 10–14) and can open every page except row 15.

Known inconsistencies​

Each item is a place where two surfaces or two writers disagree. Items with a ticket are tracked there.

  1. Mongo isExpired has two meanings (CU-123ztrcwz02; fixed on backend-services develop by e548f9531, see Changes after these commits). The sync writes closeIfExpired && ended. The hourly sweep writes true for every ended document. So an ended event with auto-close off has isExpired = false after a resync and true after a sweep. Readers that use isExpired without closeIfExpired (public event filters, RSS, facets, the MW "expired" badge) flip between the two.
  2. Mongo breaks close_at wins. The grid hub requires (closeIfExpired = false OR isExpired = false) even when closeAt is in the future, and the Archive includes (isExpired AND closeIfExpired) without looking at closeAt. Scenario row 6. The same pattern is in calendar-get-resources.aggregation.ts, calendar-get-resource-schedule.aggregation.ts, get-resource-status-counter.aggregation.ts, search-resource.aggregation.ts, vector-search-resource.aggregation.ts and mongodb.service.ts → calculateResourceStatus().
  3. The Archive has no live closeAt check. The hub checks closeAt against the current time; the Archive needs the stored closed = true. Between the close date and the next resync or sweep, the event is in neither list.
  4. A manual close deletes the Mongo document, so manually closed events are never in the Archive and are absent from every Mongo reader.
  5. Some closes leave stale Mongo documents (recurring reschedule, PHP API v1 saves). Scenario row 9.
  6. Legacy and grid hubs apply different rules: close_at wins, the approved set, published_at overriding is_private, full events, connectors, cross-org shares, and the start window.
  7. Status 8 and 10 are hidden by PHP for everyone, are in no Mongo array, and are listed in org-dashboard Event Details (status 8 is counted as pending there).
  8. Groups::isPublished() always returns true. X ?? 0 < time() parses as X ?? (0 < time()). A future publish date hides the event from lists but not from its page.
  9. published_at overrides is_private only in the legacy hub. The card appears, but a non-admin who clicks it is redirected.
  10. Registration server checks are weaker than the buttons. users-subscribe and RegisterBundledEvents ignore plain ends_at, is_private and published_at. subscribe-external has no guards. RegistrationEligibilityService ignores close_at, ends_at, the registration window and max_members.
  11. The logged-in button builder stops only on status 1 and 5. An admin who opens an event with another non-approved status sees a working Register button.
  12. Only the legacy hub hides full events. Mongo has no notion of full.
  13. The widget start floor is shifted by the org's UTC offset (CU-123ztrcvt1h).
  14. Three status vocabularies: superco-management getClosedStatus() (Auto closed first; has Expired and Full), backend EventClosureStateEnum (canonical order; no Expired, no Full), and Mongo isExpired.
  15. Monthly stats "Active" ignores close_at and published_at, treats private as inactive, accepts approval in any hub, and is not recomputed when a date passes.
  16. Approval arrays can be truncated for events shared into roughly 120 hubs or more, because the sync builds them with GROUP_CONCAT and the MySQL default group_concat_max_len is 1024.

QA queries​

Replace the :placeholders before you run a query. In MySQL, groups and key are reserved words and need backticks.

MySQL: full state of one event in every hub​

SELECT
g.id,
g.`name`,
cg.community_id AS hub_id,
(cg.community_id = g.original_community_id) AS is_origin_hub,
cg.approval_status_id,
s.name AS approval_status,
g.closed,
g.close_at,
g.close_if_date_expired,
FROM_UNIXTIME(g.starts_at) AS starts_at_utc,
FROM_UNIXTIME(g.ends_at) AS ends_at_utc,
(g.ends_at > 0 AND g.ends_at < UNIX_TIMESTAMP()) AS is_ended,
(COALESCE(g.closed, 0) = 1
OR IF(g.close_at IS NOT NULL,
g.close_at < CURRENT_TIMESTAMP(),
COALESCE(g.close_if_date_expired, 0) = 1
AND COALESCE(g.ends_at, 0) > 0
AND g.ends_at < UNIX_TIMESTAMP())) AS is_closed,
g.is_private,
g.published_at,
(g.published_at IS NULL OR g.published_at < CURRENT_TIMESTAMP()) AS is_published,
g.subscribe_enabled,
FROM_UNIXTIME(g.subscribe_enabled_at) AS subscribe_enabled_at_utc,
FROM_UNIXTIME(g.close_subscribe_enabled_at) AS close_subscribe_enabled_at_utc,
g.data_link,
g.parent_community_id,
g.organization_id
FROM `groups` g
JOIN communities_groups cg ON cg.group_id = g.id
LEFT JOIN approval_status s ON s.id = cg.approval_status_id
WHERE g.id = :event_id;

FROM_UNIXTIME uses the session time zone. Run SET time_zone = '+00:00'; first to read the values in UTC.

MySQL: is the event in the legacy hub list for a guest?​

SELECT g.id
FROM `groups` g
JOIN communities_groups cg ON cg.group_id = g.id AND cg.community_id = :hub_id
WHERE g.id = :event_id
AND cg.approval_status_id IN (2, 3, 4)
AND g.closed = 0
AND IF(g.close_at IS NOT NULL,
g.close_at > CURRENT_TIMESTAMP(),
g.close_if_date_expired = 0 OR g.ends_at IS NULL OR g.ends_at > UNIX_TIMESTAMP())
AND IF(g.published_at IS NULL, NOT g.is_private, g.published_at < CURRENT_TIMESTAMP())
AND g.parent_community_id IS NULL;

One row means Yes. This query does not apply the full-event option.

MySQL: which renderer does a hub use, and is the org archive on?​

SELECT community_id, lang, value
FROM options
WHERE `key` = 'iframe_events_grid_enabled'
AND community_id IN (:hub_id, 0);

SELECT o.id, o.is_archive_shown
FROM organizations o
JOIN organizations_communities oc ON oc.organization_id = o.id
WHERE oc.community_id = :hub_id;

The hub's own row wins over the default row (community_id = 0). Value 1 means a grid hub.

MySQL: find sample events for a scenario​

Ended, auto-close off, still open (scenario row 3):

SELECT g.id, cg.community_id
FROM `groups` g
JOIN communities_groups cg ON cg.group_id = g.id AND cg.approval_status_id IN (2, 3)
WHERE g.closed = 0 AND g.close_at IS NULL
AND COALESCE(g.close_if_date_expired, 0) = 0
AND g.ends_at > 0 AND g.ends_at < UNIX_TIMESTAMP()
AND g.is_private = 0 AND g.parent_community_id IS NULL
LIMIT 20;

Future close_at, auto-close on, ended (scenario row 6):

SELECT g.id
FROM `groups` g
WHERE COALESCE(g.closed, 0) = 0
AND g.close_at > CURRENT_TIMESTAMP()
AND g.close_if_date_expired = 1
AND g.ends_at > 0 AND g.ends_at < UNIX_TIMESTAMP()
LIMIT 20;

Change the WHERE clause to match another row of the scenario table.

Mongo: the event's document​

db.getCollection('vector-search-resources').findOne(
{ organizationId: ORG_ID, resourceId: EVENT_ID },
{
closed: 1,
isExpired: 1,
closeIfExpired: 1,
closeAt: 1,
startsAt: 1,
endsAt: 1,
publishedAt: 1,
isPrivateEvent: 1,
approvedCommunities: 1,
pendingCommunities: 1,
rejectedCommunities: 1,
resourceType: 1,
externalJoinUrl: 1,
updatedAt: 1,
}
);

null means there is no document: the event is closed manually, belongs to no organization, or has no valid creator. To spot a stale document, compare these fields with the MySQL query above. Do not compare updatedAt: the sync writes the document only when its content hash changes.

Mongo: is the event in the grid hub for a regular viewer?​

const now = new Date();
db.getCollection('vector-search-resources').countDocuments({
organizationId: ORG_ID,
resourceId: EVENT_ID,
approvedCommunities: HUB_ID,
closed: false,
isPrivateEvent: { $ne: true },
$and: [
{ $or: [{ closeIfExpired: false }, { isExpired: false }] },
{ $or: [{ closeAt: null }, { closeAt: { $gt: now } }] },
{ $or: [{ publishedAt: null }, { publishedAt: { $lt: now } }] },
{ $or: [{ startsAt: null }, { startsAt: { $gte: new Date('2023-01-01T00:00:00Z') } }] },
],
});

Mongo: is the event in the grid Archive?​

db.getCollection('vector-search-resources').countDocuments({
organizationId: ORG_ID,
resourceId: EVENT_ID,
approvedCommunities: HUB_ID,
isPrivateEvent: { $ne: true },
$or: [{ closed: true }, { isExpired: true, closeIfExpired: true }],
});

A result of 1 means Yes. The MW button is shown only when the org's is_archive_shown = 1.

Code index​

SurfaceCode
Canonical closurePHP models/Groups.php → isClosed(), getIsExpired(), getClosedStatus(); BE libs/utils/event-closure.util.ts
Registration window, publish checkPHP models/Groups.php → isSubscriptionEnabled(), isPublished()
Legacy hub listsPHP models/View/GroupsList/*.php; PHP models/Communities.php → getGroups(), getActiveGroups()
Hub renderer switchPHP components/helpers/CommunitySettings.php → isNewGridEnabled()
Event page accessPHP controllers/GroupsController.php → actionView(); PHP domain/UserAccessChecker.php → canViewGroup()
Registration buttonsPHP models/View/GroupsPageViewModel.php → getActionButtons(), getGuestActionButtons()
Registration endpointsPHP controllers/GroupsController.php → actionUsersSubscribe(), actionSubscribeAfterLogin(), actionSubscribeExternal(); BE apps/external-gateway/src/controllers/registration-shared/registration-eligibility.service.ts
Mongo predicatesBE apps/vector-search/src/query-builders/vector-search.query-builder.ts; BE apps/vector-search/src/aggregations/calendar-get-match.ts
Mongo sync mappingBE libs/utils/vector-search.utils.ts → getVectorSearchDocument(); BE apps/vector-search/src/search/vector-search.service.ts → addResourcesStatusAndSharedCommunities()
Mongo sweep and closeBE apps/vector-search/src/search/services/mongodb.service.ts → updateExpiredOrganizationResources(), closeOrganizationResourcesWithPassedCloseDate(), closeVectorSearchResource(); SQS src/vector-search/vector-search.service.ts → syncResources()
Manual close and reopenBE apps/groups/src/recurring-resources/recurring-resources.services.ts → closeResourcesByIds(), reopenResourcesByIds()
Monthly stats ActiveBE apps/organizations-stats/src/resources-stats/collectors/resources-stats-collector.service.ts
Org-dashboard Event DetailsBE apps/groups/src/groups/groups-attributes.service.ts → getOrganizationCommunityGroupsPaginated()