Feature #18637 » notifications-backfill.php
1 |
<?php
|
---|---|
2 |
|
3 |
global $wpdb; |
4 |
|
5 |
$invites = $wpdb->get_results( "select id,invitee_id,inviter_id,date_created from wp_1_cac_invites where status = 'pending' and invitee_id != 0 and date_created >= '2023-01-01 00:00:00'" ); |
6 |
|
7 |
$progress = \WP_CLI\Utils\make_progress_bar( 'Generating notifications', count( $invites ) ); |
8 |
|
9 |
foreach ( $invites as $invite ) { |
10 |
$progress->tick(); |
11 |
|
12 |
bp_notifications_add_notification( array( |
13 |
'user_id' => $invite->invitee_id, |
14 |
'item_id' => $invite->id, |
15 |
'secondary_item_id' => $invite->inviter_id, |
16 |
'date_notified' => $invite->date_created, |
17 |
'component_name' => 'caco', |
18 |
'component_action' => 'new_invitation', |
19 |
) ); |
20 |
}
|
21 |
|
22 |
$progress->finish(); |