AppCommunity Hooks and Filters

AppCommunity uses a modified version of the BuddyPress REST API. You can use filters and action hooks to modify API responses.

Sample Code

This sample code uses the hooks and filters below to add custom content to the app.

Notify admin of bad words:

Include nested replies:

Add custom profile fields:

Add custom member fields:

Filter activity feed:

Extend activity type:


Filters are mainly used to change the arguments before a response is created. For example, you can change what activity items are shown in the activity feed using a filter like this:

Each component has a filter to get items with 2 arguments: $args and $request: appcommunity_{component}_get_items_args

See the gist above for an example.

Available filters:

  • appcommunity_activity_get_items_args
  • appcommunity_members_get_items_args
  • appcommunity_groups_get_items_args
  • appcommunity_messages_get_items_args

Action Hooks

Action hooks are mainly used to do something  after the API response has been created. For example, you could look at the response object and send an email to the admin if there is a curse word in it.

Most hooks have 3 arguments unless otherwise noted: $items, $retval, $request

Available hooks:

  • appcommunity_activity_get_items

  • appcommunity_activity_get_item

  • appcommunity_activity_create_item

  • appcommunity_activity_create_item_with_image

  • appcommunity_activity_update_item

  • appcommunity_friends_get_requests ( only 2 arguments )

  • appcommunity_groups_get_items

  • appcommunity_group_get_item

  • appcommunity_members_get_items

  • appcommunity_members_get_item

  • appcommunity_messages_get_items

  • appcommunity_messages_get_item ( 2 arguments )

  • appcommunity_notification_get_items

Template Hooks

AppCommunity has template hooks in the app files. These are used to display extra content in the app, for example add extra member profile fields to the profile page.

These are used a little bit differently than our other template hooks, but the concept is the same. Instead of adding data to a post type, you need to add data to a certain API response. View the example code here.

Profile custom content

Available template hooks:

  • appp.below_content
  • appp.above_content

Use these with the following filters:

  • appcommunity_prepare_user
  • appcommunity_prepare_group

Member custom content

Available template hooks:

  • before_item
  • after_item

Use these with the following filters:

  • bp_rest_members_prepare_value

API Endpoints

AppCommunityuses the following API Endpoints for retrieving data. You can test these endpoints using a tool like Postman to see exactly what data WordPress passes to the app.


Activity from specific Group ID:wp-json/ap-bp/v1/activity/?primary_id=#