HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/test.breadsecret.com_bak/test_fcm.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once('wp-load.php');
global $wpdb;

$order_id = 202912;
$user_id = 2161;
$order = new WC_Order( $order_id );
$device_token = get_user_meta($user_id, "device_token", true);
$title = "BSB (TEST)";
$message = "Order# ".$order->get_order_number()." is created";
$type = "TEST BUTTON";



echo "<table style='border-collapse: collapse;' border='1' cellspacing='3' cellpadding='3'>";
    echo "<tr><td>user_id</td><td>".$user_id."</td></tr>";
    echo "<tr><td>device_token</td><td>".$device_token."</td></tr>";
    echo "<tr><td>title</td><td>".$title."</td></tr>";
    echo "<tr><td>message</td><td>".$message."</td></tr>";
    echo "<tr><td>type</td><td>".$type."</td></tr>";

$wpdb->insert(
    'bsb_notification_center', 
    array(
        'hash'=>wp_generate_uuid4(),
        'user_id'=>$user_id,
        'title'=>$title,
        'message'=>$message,
        'device_token'=>$device_token,
        'type'=>$type,	
        'reference_id'=>intval(0)
    )
);

$notification_id = $wpdb->insert_id;

initPushNotificationAppDevice($title, $message, $device_token, $type, $order_id, $notification_id);

    echo "<tr><td>notification_id</td><td>".$notification_id."</td></tr>";
    echo "<tr><td>status</td><td>SENT</td></tr>";
echo "</table>";

?>