Changes between Initial Version and Version 1 of Ticket #9327
- Timestamp:
- 02/06/2026 02:24:54 AM (9 months ago)
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 Need1 == The Need 2 2 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: 4 4 5 5 - **"Only me"** — private activity visible only to the author … … 12 12 This 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. 13 13 14 ####Current State14 == Current State 15 15 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: 17 17 18 18 - `bp_activity_get_where_conditions` lets addons inject WHERE clauses … … 23 23 An 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. 24 24 25 ####Proposed Change25 == Proposed Change 26 26 27 27 **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: 28 28 29 ```sql 29 === sql 30 {{{ 30 31 -- Added after the existing `is_spam` column in the CREATE TABLE definition: 31 32 privacy varchar(75) NOT NULL DEFAULT 'public', 32 33 -- Added to the KEY list: 33 34 KEY privacy (privacy) 34 ``` 35 }}} 35 36 36 37 **Model class (`BP_Activity_Activity`):** … … 47 48 **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. 48 49 49 ####Scope50 == Scope 50 51 51 52 - ~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`) … … 53 54 - Existing queries that don't pass `privacy` return all activities as before 54 55 - `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 Handle56 57 == What Core Provides vs. What Addons Handle 57 58 58 59 To be explicit about scope: this proposal adds **storage and query filtering only**. Core would: … … 70 71 This 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.). 71 72 72 ####Prior Art73 == Prior Art 73 74 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.75 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. 75 76 76 77 I'm happy to submit a PR for this change.