Skip to content

AJAX Endpoints

The plugin registers two AJAX endpoints. Both require a logged-in user.


Action: delete_schedule_activity

Requires: logged-in user, activity ownership or delete permission

Nonce: bp_activity_delete_link (passed as _wpnonce)

jQuery.post( bpsa_ajax_object.ajax_url, {
action: 'delete_schedule_activity',
id: activityId, // integer, the activity ID
_wpnonce: nonceValue, // from wp_create_nonce( 'bp_activity_delete_link' )
is_comment: false, // optional: true if deleting an activity comment
is_single: false // optional: true if on a single activity page
} );
{
"success": true,
"data": {
"deleted": [123]
}
}

If is_single was true, the response also includes a redirect URL:

{
"success": true,
"data": {
"deleted": [123],
"redirect": "https://example.com/members/username/"
}
}
{
"success": false,
"data": {
"feedback": "<div class=\"bp-feedback bp-messages error\">There was a problem deleting your scheduled activity. Please try again.</div>"
}
}

Error conditions: not a POST request, nonce fails, user not logged in, missing or non-numeric ID, activity not found, user lacks delete permission.


Action: get_schedule_activity

Requires: logged-in user, nonce verification

Nonce: bpsa_ajax_security (available in bpsa_ajax_object.ajax_nonce)

jQuery.post( bpsa_ajax_object.ajax_url, {
action: 'get_schedule_activity',
page: 2, // page number (integer, 1-1000)
_wpnonce: bpsa_ajax_object.ajax_nonce
} );
{
"success": true,
"data": {
"contents": "<div class=\"buddypress-schedule-activity-lists\">...</div>"
}
}

The contents value is an HTML string containing the activity list for the requested page. The frontend appends this to the existing list.

{
"success": false,
"data": {
"message": "Security check failed."
}
}

The plugin localizes a bpsa_ajax_object variable on the frontend. Available properties:

Property Type Description
ajax_url string WordPress AJAX URL
ajax_nonce string Nonce for bpsa_ajax_security
nouveau bool/string true if Nouveau template, false if Legacy, empty string otherwise
confirm string Delete confirmation message
buddyboss mixed BuddyBoss identifier, empty string if not BuddyBoss
youzify string 'youzify' if Youzify is active, empty string otherwise
add_schedule_text string “Schedule an activity”
button_schedule_text string “Schedule”
schedule_activity_string string “Scheduled For:”
schedule_activity_timeat string “at”
count int Number of scheduled posts for the current displayed user
bb_theme bool true if BuddyBoss Theme or BuddyBoss Child is active

The object is only localized when the current user can publish activities or when the current BuddyPress component is schedule-activity.