Skip to content

Hooks and Filters

This page lists every action and filter the plugin exposes or relies on that developers are likely to need.


Changes the label of the “Scheduled Posts” navigation tab on a user’s profile.

add_filter( 'buddypress_schedule_activity_label', function( $label ) {
return __( 'My Queue', 'your-textdomain' );
} );

Parameters:

  • $label (string) — Default is 'Scheduled Posts <span class="count">N</span>'. On BuddyBoss, the count span is absent and the default is plain 'Scheduled Posts'.

Returns: string

Note: The label is run through esc_html before being set as the nav item name, so HTML tags in your return value may be stripped depending on BuddyPress version.


Changes the URL slug for the scheduled posts tab on member profiles.

add_filter( 'buddypress_schedule_activity_slug', function( $slug ) {
return 'scheduled-posts';
} );

Parameters:

  • $slug (string) — Default: 'schedule-activity'

Returns: string

Important: The same slug is used both for the nav item and for the AJAX scope identifier. If you change it, also update any custom JavaScript that hardcodes 'schedule-activity' as a scope value.


Changes how often the cron job checks for activities ready to publish.

add_filter( 'buddypress_schedule_activity_frequency', function( $frequency ) {
return 'every_five_minutes';
} );

Parameters:

  • $frequency (string) — Default: 'bp_every_min' (every 60 seconds)

Returns: string — Must be a registered cron schedule. Register custom schedules with bp_core_cron_schedules (see below) or WordPress’s cron_schedules filter.

Note: Changing the frequency only takes effect after the existing scheduled event is cleared. Call wp_clear_scheduled_hook( 'buddypress_schedule_activity_publish' ) once to force re-registration on the next page load.


Adds custom cron intervals that the plugin recognizes alongside the default bp_every_min.

add_filter( 'bp_core_cron_schedules', function( $schedules ) {
$schedules['every_five_minutes'] = array(
'interval' => 300,
'display' => __( 'Every 5 Minutes', 'your-textdomain' ),
);
return $schedules;
} );

Parameters:

  • $schedules (array) — Keyed by schedule name, each entry has interval (seconds) and display (string).

Returns: array


Gates whether the current user can use the scheduling UI. The plugin calls this filter with the capability string 'publish_activity' to decide whether to enqueue its scripts and CSS.

add_filter( 'bp_nouveau_current_user_can', function( $can, $capability, $user_id ) {
// Only allow users with a custom "premium_member" role to schedule activities.
if ( 'publish_activity' === $capability ) {
$user = get_userdata( $user_id );
return $user && in_array( 'premium_member', (array) $user->roles, true );
}
return $can;
}, 10, 3 );

Parameters:

  • $can (bool) — Current decision; defaults to is_user_logged_in()
  • $capability (string) — Capability being checked
  • $user_id (int) — Logged-in user ID

Returns: bool


bp_activity_time_since / bp_core_time_since

Section titled “bp_activity_time_since / bp_core_time_since”

The plugin hooks both of these at priority 100 to replace the standard “X minutes ago” text with “Scheduled for: Date Time” on the scheduled posts tab.

If you need to change the format of that label, hook at priority 101 or higher:

add_filter( 'bp_activity_time_since', function( $time_since, $activity ) {
$status = bp_activity_get_meta( $activity->id, '_bp_activity_status', true );
if ( 'scheduled' === $status ) {
$ts = strtotime( $activity->date_recorded );
return sprintf( 'Publishing %s', date_i18n( get_option( 'date_format' ), $ts ) );
}
return $time_since;
}, 101, 2 );

The custom cron action that triggers the publish check. The plugin’s handler runs at the default priority (10). Hook before or after it to run your own logic.

// Runs before the plugin publishes activities.
add_action( 'buddypress_schedule_activity_publish', function() {
// Your pre-publish logic here.
}, 5 );
// Runs after the plugin has published activities.
add_action( 'buddypress_schedule_activity_publish', function() {
// Your post-publish logic here.
}, 20 );

Note: At the time your callback at priority 20 runs, the plugin has already deleted _bp_activity_status from published activities. You cannot distinguish freshly-published activities from regular ones using that meta key. If you need to act on activities just published, use the pre-publish hook (priority < 10) to capture their IDs before the plugin processes them.


Standard BuddyPress hook. The plugin processes scheduling at priority 9999. Hook before that to act on the raw submission, or after to inspect the result.

// Before scheduling (priority < 9999).
add_action( 'bp_activity_posted_update', function( $content, $user_id, $activity_id ) {
// Activity exists but scheduling meta may not be set yet.
}, 10, 3 );
// After scheduling (priority > 9999).
add_action( 'bp_activity_posted_update', function( $content, $user_id, $activity_id ) {
$status = bp_activity_get_meta( $activity_id, '_bp_activity_status', true );
if ( 'scheduled' === $status ) {
// Activity was scheduled — do something.
}
}, 10000, 3 );

Same as above but for group activity. The plugin processes at priority 10.

add_action( 'bp_groups_posted_update', function( $content, $user_id, $group_id, $activity_id ) {
$status = bp_activity_get_meta( $activity_id, '_bp_activity_status', true );
if ( 'scheduled' === $status ) {
// Group activity was scheduled.
}
}, 20, 4 );

The plugin hooks here at priority 10 to clean up _bp_activity_status and _bp_schedule_activity_title_for_youzify meta when an activity is deleted through BuddyPress’s standard delete path.

add_action( 'bp_activity_before_delete', function( $args ) {
if ( ! empty( $args['id'] ) ) {
$activity_id = absint( $args['id'] );
// Your pre-delete logic for scheduled activities.
}
}, 5, 1 ); // Priority 5 runs before the plugin's cleanup at priority 10.

The plugin exposes a localized object bpsa_ajax_object on every frontend page where scheduling is available. Developers can read from it but should not write to it at runtime — these values are set server-side.

Key Type Description
ajax_url string admin-ajax.php URL
ajax_nonce string Nonce for get_schedule_activity and bpsa_ajax_security actions
nouveau bool|string true for Nouveau theme package, false for Legacy, '' for unknown
buddyboss bool Whether BuddyBoss Platform is active
youzify string 'youzify' if Youzify active, '' otherwise
confirm string Delete confirmation message
add_schedule_text string Tooltip on the clock icon
button_schedule_text string Submit button label when scheduling ('Schedule')
schedule_activity_string string Inline label 'Scheduled For:'
schedule_activity_timeat string Conjunction word 'at'
count int Number of scheduled activities for the displayed user
activity_schedule.params object Contains scheduled_post_nonce and scheduled_post_enabled
activity_schedule.strings object UI strings for the scheduling dialog