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
*/
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. |