Files
easystream/api/notifications_count.php
Krystie f50b493df2 feat: Add comprehensive notification system with email support
- Create notification management system with VNotifications class
- Build notification API endpoints (get, mark read, delete, preferences)
- Implement notification bell UI widget with real-time polling
- Add email queue system with digest support (instant/hourly/daily/weekly)
- Create notification trigger helpers for common events
- Add fine-grained user preference controls
- Implement cron script for email processing and cleanup
- Document setup and usage in docs/NOTIFICATIONS.md

Features:
- In-app notifications with dropdown
- Email delivery with batching
- 6 notification types (comment, like, subscribe, upload, mention, system)
- User preference controls per notification type
- Lightweight polling (30s interval)
- Auto-cleanup of old notifications (90 days)
- Production-ready with proper error handling
2026-03-30 17:11:08 -07:00

30 lines
708 B
PHP

<?php
/**
* Notifications Count API (lightweight polling)
*
* GET /api/notifications_count.php - Get unread count only
*/
require_once dirname(__DIR__) . '/f_core/config.boot.php';
require_once dirname(__DIR__) . '/f_core/f_classes/class.notifications.php';
header('Content-Type: application/json');
// Require authentication
session_start();
if (empty($_SESSION['user_id'])) {
http_response_code(401);
echo json_encode(['success' => false, 'error' => 'Authentication required']);
exit;
}
$usr_id = $_SESSION['user_id'];
$notifications = new VNotifications();
$count = $notifications->getUnreadCount($usr_id);
echo json_encode([
'success' => true,
'unread_count' => $count
]);