Skip to content

Private group events are readable by anyone #134

Closed

Description

@MartinPaulEve

hc-custom's capability mapping for Event Organiser grants read_private_events to every user, including anonymous visitors. The handler treats it as a cap with no event context and falls through to the branch that returns exist.

Because Event Organiser's calendar queries rely on that capability (via WP_Query's perm => readable) to decide whether private posts are visible, events belonging to private and hidden groups, which are stored as private posts, come back for anyone who asks. Reproduced on the local test stack: an anonymous request to the calendar's AJAX endpoint returned a private group's event alongside the public ones.

The cap should keep WordPress's role-based mapping. Group members still need to see their group's private events on the group calendar, so the group-scoped calendar query should rely on its own group-membership check rather than on this capability.

Activity

  1. added a commit that references this issue on Oct 4, 2026
    afd7dc9
  2. MartinPaulEve commented on Oct 4, 2026

    @MartinPaulEve
    ContributorAuthor

    Came out of review on #133. The capability handler was answering "yes" to read_private_events for everyone because it had no event to check against, and Event Organiser leans on that cap when deciding whether private events show up in calendar queries. On the test stack an anonymous request to the calendar endpoint returned a private group's event.

    Fixed in the same branch: the cap now keeps its normal role-based meaning, and the calendars check group membership directly instead. Members still see their own groups' private events, both on the group calendar and on the sitewide one; nobody else does.

  3. bjr70 commented on Oct 4, 2026

    @bjr70

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions