LLMS_Notifications_Query::get_notifications()
Convert raw results to notification objects.
Return Return
Source Source
File: includes/notifications/class.llms.notifications.query.php
public function get_notifications() {
$notifications = array();
$results = $this->get_results();
if ( $results ) {
foreach ( $results as $result ) {
$notification = ( new LLMS_Notification( $result->id ) )->load();
// If the notification status is 'error' and errored notifications were not requested, skip it.
if ( 'error' === $notification->get( 'status' ) && ! in_array( 'error', $this->arguments['statuses'], true ) ) {
continue;
}
$notifications[] = $notification;
}
}
if ( $this->get( 'suppress_filters' ) ) {
return $notifications;
}
/**
* Filters the list of notifications.
*
* @since 3.8.0
*
* @param array $notifications Array of {@see LLMS_Notification} instances.
* @param LLMS_Notifications_Query $notifications_query Instance of `LLMS_Notifications_Query`.
*/
return apply_filters( 'llms_notifications_query_get_notifications', $notifications, $this );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.1.0 | When loading a notification, if errored, exclude it when not explictly requested.<br> Drop usage of this->get_filter( 'default_args' ) in favor of llms_notifications_query_get_notifications. |
| 3.8.0 | Introduced. |