bp_nouveau_notifications_sort( array $filters = array() )
Sort Notifications according to their position arguments.
Description
Parameters
- $filters
-
(array) (Optional) The notifications filters to order.
Default value: array()
Return
(array) The sorted filters.
Source
File: bp-templates/bp-nouveau/includes/notifications/functions.php
function bp_nouveau_notifications_sort( $filters = array() ) { $sorted = array(); if ( empty( $filters ) || ! is_array( $filters ) ) { return $sorted; } foreach ( $filters as $filter ) { $position = 99; if ( isset( $filter['position'] ) ) { $position = (int) $filter['position']; } // If position is already taken, move to the first next available if ( isset( $sorted[ $position ] ) ) { $sorted_keys = array_keys( $sorted ); do { $position += 1; } while ( in_array( $position, $sorted_keys, true ) ); } $sorted[ $position ] = $filter; } ksort( $sorted ); return $sorted; }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.