Skip to content

Instantly share code, notes, and snippets.

@marlonassuncao
Last active December 2, 2022 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marlonassuncao/ee92ec84ac8ceefe2cc5091c7133ddaf to your computer and use it in GitHub Desktop.
Save marlonassuncao/ee92ec84ac8ceefe2cc5091c7133ddaf to your computer and use it in GitHub Desktop.
functions.php
<?php
require_once 'ActivityPublishNotification.php';
use BuddyBossApp\Jobs;
use BuddyBossApp\Notification\IntegrationAbstract;
add_action('bp_activity_after_save', 'where_activity_from', 10, 3);
function where_activity_from( $activity ) {
// print_r($activity->content);
$users = get_users( array(
'fields' => 'ids',
'number' => 200,
'paged' => $task_data['paged'],
) );
if ( ! empty( $users ) ) {
IntegrationAbstract::send_push(
array(
'primary_text' => $activity->content,
'secondary_text' => $activity->content,
'user_ids' => $users,
'data' => array(),
'push_data' => array(
'link' => get_permalink( 1 ),
),
'subscription_type' => 'notification_custom_activity',
'normal_notification' => true,
'normal_notification_data' => array(
'component_name' => 'notification_custom_activity',
'component_action' => 'notification_custom_activity_action',
'item_id' => 1,
'secondary_item_id' => get_the_title( 1 ),
)
)
);
$jobs = Jobs::instance();
$jobs->add( 'notification_custom_activity', array(
'book_id' => 1,
'paged' => ( 1 + 1 ),
'timestamp' => time(),
) );
$jobs->start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment