Sometimes we need to integrate 3rd party plugins or custom plugins with buddyPpress. A common use is like “After user does X post an activity to buddyPress on behalf of that user”. A more specific example could be with our CBX Poll plugin. In CBX Poll plugin we have close integration with buddyPress – when user creates a poll there is an activity auto post to buddyPress on behalf of that user, same way while user votes a poll which increase engagement in buddyPress. In this blog post I will try to write details how we can implement such buddyPress posting from any custom plugin.
Posting to BuddyPress
To post in buddyPress there is a function ready and it’s name is
bp_activity_add($buddy_post) and you need to prepare an array with necessary properties for variable $buddy_post.
The below code example will help to understand how we used to post in buddyPress activity for user votes poll notification.
Check more details in buddyPress codex about bp_activity_add