Esempio n. 1
0
function apoc_mark_notifications_read()
{
    // Get the user data
    $user_id = $_POST['id'];
    // Mark all notifications as read
    BP_Notifications_Notification::mark_all_for_user($user_id);
    die("1");
}
Esempio n. 2
0
function kleo_bp_notification_mark_read()
{
    $response = array();
    if (BP_Notifications_Notification::mark_all_for_user(bp_loggedin_user_id())) {
        $response['status'] = 'success';
    } else {
        $response['status'] = 'failure';
    }
    $notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id(), 'object');
    $count = !empty($notifications) ? count($notifications) : 0;
    $response['count'] = $count;
    $response['empty'] = '<li class="kleo-submenu-item">' . __('No new notifications', 'kleo_framework') . '</li>';
    echo json_encode($response);
    exit;
}