Last active
December 2, 2022 15:09
-
-
Save marlonassuncao/ee92ec84ac8ceefe2cc5091c7133ddaf to your computer and use it in GitHub Desktop.
functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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