Hooks and Filters
Hooks and Filters
Section titled “Hooks and Filters”All hooks and filters listed here are from the plugin’s public-facing classes. They are stable as of version 1.3.2.
Filters
Section titled “Filters”bp_editable_types_activity
Section titled “bp_editable_types_activity”Controls which BuddyPress activity types are eligible for editing. By default the list contains activity_update and activity_comment.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$types |
array |
Array of editable activity type strings. |
Example — add a custom activity type:
add_filter( 'bp_editable_types_activity', function( $types ) { $types[] = 'my_custom_activity_type'; return $types;} );buddypress_can_edit_activity
Section titled “buddypress_can_edit_activity”Final filter on whether the current user can edit a specific activity. Runs after all internal checks (login, ownership, type, time window). Return false to block editing even when the internal checks pass, or return true to allow editing even when they fail.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$can_edit |
bool |
Result of all internal permission checks. |
$activity |
object |
The BP_Activity_Activity object being checked. |
Example — block editing of activities older than 48 hours regardless of settings:
add_filter( 'buddypress_can_edit_activity', function( $can_edit, $activity ) { if ( ! $can_edit ) { return false; } $age = time() - strtotime( $activity->date_recorded ); if ( $age > 2 * DAY_IN_SECONDS ) { return false; } return $can_edit;}, 10, 2 );buddypress_edit_activity_duration
Section titled “buddypress_edit_activity_duration”Filters the computed edit window in seconds before the plugin uses it for permission checks. Return 0 for no limit.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$duration |
int |
Duration in seconds derived from the saved setting. 0 means unlimited. |
Example — override to a flat 2-hour window regardless of admin settings:
add_filter( 'buddypress_edit_activity_duration', function( $duration ) { return 2 * HOUR_IN_SECONDS;} );buddypress_get_edit_activity_content
Section titled “buddypress_get_edit_activity_content”Filters the activity content before it is sent to the edit modal. The content at this point has already had @mention anchor tags converted to plain text and surrounding <p> tags stripped.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$content |
string |
The cleaned text that pre-fills the edit textarea. |
$activity |
object |
The BP_Activity_Activity object. |
buddypress_edit_activity_content
Section titled “buddypress_edit_activity_content”Filters the content just before it is saved to the database after a member submits an edit.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$content |
string |
The sanitized new content. |
$activity_id |
int |
ID of the activity being updated. |
buddypress_bp_edit_activity_action
Section titled “buddypress_bp_edit_activity_action”Filters the activity action string (the line that reads “Member posted an update X minutes ago”) after the plugin appends the (edited) label. Applies to both standard BuddyPress and BuddyBoss.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$action |
string |
The modified action string, already containing the edited label when applicable. |
$activity |
object |
The BP_Activity_Activity object. |
bp_activity_comment_content_before_save
Section titled “bp_activity_comment_content_before_save”Filters comment content before it is written to the database when a member saves a comment edit.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$content |
string |
The sanitized new comment content. |
$comment_id |
int |
ID of the activity comment being updated. |
bp_edit_activity_admin_tabs
Section titled “bp_edit_activity_admin_tabs”Filters the array of admin sidebar tabs shown on the plugin’s settings screen. Use this to add, remove, or reorder tabs.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$tabs |
array |
Associative array keyed by tab slug. Each value is an array with label, icon (dashicon class), and group keys. |
Actions
Section titled “Actions”bp_before_edit_activity_template
Section titled “bp_before_edit_activity_template”Fires inside the edit activity modal, before the <form> element.
bp_after_edit_activity_template
Section titled “bp_after_edit_activity_template”Fires inside the edit activity modal, after the closing </form> tag.
bp_edit_activity_fields
Section titled “bp_edit_activity_fields”Fires inside the edit activity <form>, in the additional content area below the textarea. Use this to inject extra fields (e.g., location, mood) that companion plugins provide.
Example — add a hidden field for a custom extension:
add_action( 'bp_edit_activity_fields', function() { echo '<input type="hidden" name="my_plugin_extra" value="1">';} );bp_get_addition_activity_content
Section titled “bp_get_addition_activity_content”Fires during the AJAX request that loads existing activity content into the modal. Output captured here is sent back to the browser as bp_get_additional_content in the JSON response. Use this to load extra data (e.g., a stored check-in location) alongside the main text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$activity |
object |
The BP_Activity_Activity object being loaded. |
buddypress_edit_activity_before_save_activity_content
Section titled “buddypress_edit_activity_before_save_activity_content”Fires inside the save AJAX handler, after permission checks pass but before the content is written to the database.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$activity_id |
int |
ID of the activity about to be saved. |
buddypress_edit_activity_after_save_activity_content
Section titled “buddypress_edit_activity_after_save_activity_content”Fires after the activity has been saved successfully.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$activity_id |
int |
ID of the activity that was saved. |
$activity |
object |
The updated BP_Activity_Activity object. |
bp_before_edit_comment_template
Section titled “bp_before_edit_comment_template”Fires inside the edit comment modal, before the <form> element.
bp_after_edit_comment_template
Section titled “bp_after_edit_comment_template”Fires inside the edit comment modal, after the closing </form> tag.
bp_edit_comment_fields
Section titled “bp_edit_comment_fields”Fires inside the edit comment <form>, in the additional content area below the textarea. Mirrors bp_edit_activity_fields for the comment modal.
AJAX actions
Section titled “AJAX actions”These actions are handled server-side for logged-in users only. Both check the buddypress-edit-activity nonce.
| AJAX action | Handler method | Purpose |
|---|---|---|
buddypress_edit_activity_get |
buddypress_edit_activity_get_content() |
Load activity content into the edit modal. |
buddypress_edit_activity_save |
buddypress_edit_activity_save_content() |
Save edited activity content. |
bp_edit_activity_comment_get_content |
ajax_get_comment_content() |
Load comment content into the comment edit modal. |
bp_edit_activity_comment_save_content |
ajax_save_comment_content() |
Save edited comment content. |
All four are wp_ajax_* actions (require login). There are no wp_ajax_nopriv_* counterparts.
Activity meta keys
Section titled “Activity meta keys”| Meta key | Type | Meaning |
|---|---|---|
_bp_edit_activity |
bool |
Present and true when an activity post has been edited at least once. |
_bp_comment_edited |
bool |
Present and true when an activity comment has been edited at least once. |
_bp_comment_edited_time |
string |
MySQL timestamp of the most recent comment edit. |

