Skip to content

Hooks and Filters

All hooks and filters listed here come from the plugin’s shipped classes and are stable as of version 1.3.3.


Controls which BuddyPress activity types are eligible for editing. The base list is activity_update; the plugin adds activity_comment for comment editing, and activity_status when Youzify is active.

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;
} );

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 true to allow it 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 );

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:

add_filter( 'buddypress_edit_activity_duration', function( $duration ) {
return 2 * HOUR_IN_SECONDS;
} );

Filters the activity content before it is sent to the edit modal. At this point @mention anchor tags have been 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.

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.

Filters the activity action string 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.

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.

Filters the array of admin sidebar tabs shown on the plugin’s settings screen. Use it to add, remove, or reorder tabs.

Parameters:

Parameter Type Description
$tabs array Associative array keyed by tab slug. Each value has label, icon (dashicon class), and group keys.

Filters the sslverify flag on the EDD license API request made from the License tab. Defaults to true.

Parameters:

Parameter Type Description
$sslverify bool Whether to verify SSL on the license API call.

Fires inside the edit activity modal, before the <form> element.

Fires inside the edit activity modal, after the closing </form> tag.

Fires inside the edit activity <form>, in the additional content area below the textarea. Use it to inject extra fields (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">';
} );

Fires during the AJAX request that loads existing activity content into the modal. Output captured here is returned to the browser as bp_get_additional_content in the JSON response. Use it to load extra data (for example 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.

Fires inside the edit comment modal, before the <form> element.

Fires inside the edit comment modal, after the closing </form> tag.

Fires inside the edit comment <form>, in the additional content area below the textarea. Mirrors bp_edit_activity_fields for the comment modal.


These actions are handled server-side for logged-in users only. All four check the buddypress-edit-activity nonce. There are no wp_ajax_nopriv_* counterparts.

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.
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.