Skip to:
Content

BuddyPress.org

Changes between Initial Version and Version 1 of Ticket #9327


Ignore:
Timestamp:
02/06/2026 02:24:54 AM (9 months ago)
Author:
emaralive
Comment:

Edited the description for readability. Slightly modified the Summary.

For reference, this started as a support forum topic, see ​Add `privacy` column to `bp_activity` for per-item visibility control

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9327

    • Property Component Core → Activity
    • Property Summary Feature Request: Add `privacy` column to `bp_activity` for per-item visibility control → Enhancement Request: Add `privacy` column to `bp_activity` for per-item visibility control
    • Property Version 14.4.0
  • Ticket #9327 – Description

    initial v1  
    1 #### The Need
     1== The Need
    22
    3 BuddyPress activities have a single visibility control: `hide_sitewide` (0 or 1). This provides binary visibility — shown everywhere, or hidden from sitewide feeds. There's no way to express:
     3!BuddyPress activities have a single visibility control: `hide_sitewide` (0 or 1). This provides binary visibility — shown everywhere, or hidden from sitewide feeds. There's no way to express:
    44
    55- **"Only me"** — private activity visible only to the author
    … …  
    1212This is not a request for any specific addon's needs. It's a request for the same kind of infrastructure that `hide_sitewide` provides — a first-class column that any addon can use to implement privacy-aware features.
    1313
    14 #### Current State
     14== Current State
    1515
    16 BuddyPress 14.4.0's activity query system is well-designed for extensibility:
     16!BuddyPress 14.4.0's activity query system is well-designed for extensibility:
    1717
    1818- `bp_activity_get_where_conditions` lets addons inject WHERE clauses
    … …  
    2323An addon **can** add a `privacy` column via `dbDelta` and filter queries via `bp_activity_get_where_conditions`. However, the `save()` method has a hardcoded column list in its INSERT/UPDATE SQL (in `BP_Activity_Activity::save()`), meaning an addon must do a separate `$wpdb->update()` after every save — a double-write on every activity creation. This works but is suboptimal, and the column's general-purpose nature (used by media addons, document addons, moderation addons, group addons — not just one feature) argues for core inclusion.
    2424
    25 #### Proposed Change
     25== Proposed Change
    2626
    2727**Schema:** Add one column + index to `bp_activity` in `bp_core_install_activity_streams()` (in `bp-core-admin-schema.php`). `dbDelta()` handles adding the column on upgrade automatically:
    2828
    29 ```sql
     29=== sql
     30{{{
    3031-- Added after the existing `is_spam` column in the CREATE TABLE definition:
    3132privacy varchar(75) NOT NULL DEFAULT 'public',
    3233-- Added to the KEY list:
    3334KEY privacy (privacy)
    34 ```
     35}}}
    3536
    3637**Model class (`BP_Activity_Activity`):**
    … …  
    4748**Migration:** `dbDelta()` runs on every upgrade via `bp_core_install()`, so modifying the CREATE TABLE definition is sufficient for the schema change. A DB version bump in `bp-core-update.php` tracks the upgrade.
    4849
    49 #### Scope
     50== Scope
    5051
    5152- ~40 lines of changes across 4 files (`bp-core-admin-schema.php`, `class-bp-activity-activity.php`, `class-bp-rest-activity-endpoint.php`, `bp-core-update.php`)
    … …  
    5354- Existing queries that don't pass `privacy` return all activities as before
    5455- `hide_sitewide` continues to work as-is (orthogonal — `hide_sitewide` controls directory listing, `privacy` controls per-item access)
    55 
    56 #### What Core Provides vs. What Addons Handle
     56 
     57== What Core Provides vs. What Addons Handle
    5758
    5859To be explicit about scope: this proposal adds **storage and query filtering only**. Core would:
    … …  
    7071This mirrors how `hide_sitewide` works today — core stores the flag and filters on it; the decision of *when* to set it is made by callers (groups component, plugins, etc.).
    7172
    72 #### Prior Art
     73== Prior Art
    7374
    74 BuddyBoss Platform (a BuddyPress-derived platform) implemented this exact column. Their `bp_activity` schema includes `privacy varchar(75) NOT NULL DEFAULT 'public'`, and their media, document, video, and moderation subsystems all depend on it for privacy filtering. The column is referenced in their activity save/query paths, REST API, and template layer — making it one of the most cross-cutting additions they made to the activity table. The fact that an independent platform needed this to build standard social features demonstrates both the demand and the general-purpose nature of the column.
     75BuddyBoss Platform (a !BuddyPress-derived platform) implemented this exact column. Their `bp_activity` schema includes `privacy varchar(75) NOT NULL DEFAULT 'public'`, and their media, document, video, and moderation subsystems all depend on it for privacy filtering. The column is referenced in their activity save/query paths, REST API, and template layer — making it one of the most cross-cutting additions they made to the activity table. The fact that an independent platform needed this to build standard social features demonstrates both the demand and the general-purpose nature of the column.
    7576
    7677I'm happy to submit a PR for this change.