LLMS_AJAX_Handler::notifications_heartbeart( array $request )
Handle notification display & dismissal
Parameters Parameters
- $request
-
(array) (Required) $_POST data.
Return Return
(array)
Source Source
File: includes/class.llms.ajax.handler.php
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | */ public static function notifications_heartbeart( $request ) { $ret = array ( 'new' => array (), ); if ( ! empty ( $request [ 'dismissals' ] ) ) { foreach ( $request [ 'dismissals' ] as $nid ) { $noti = new LLMS_Notification( $nid ); if ( get_current_user_id() === absint( $noti ->get( 'subscriber' ) ) ) { $noti ->set( 'status' , 'read' ); } } } // Get 5 most recent new notifications for the current user. $query = new LLMS_Notifications_Query( array ( 'per_page' => 5, 'statuses' => 'new' , 'types' => 'basic' , 'subscriber' => get_current_user_id(), 'no_found_rows' => true, ) ); $ret [ 'new' ] = $query ->get_notifications(); |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.8.0 | |
3.37.14 | Introduced. |