bp_notifications_sort_order_form()
Output the form for changing the sort order of notifications.
Description
Source
File: bp-notifications/bp-notifications-template.php
function bp_notifications_sort_order_form() { // Setup local variables. $orders = array( 'DESC', 'ASC' ); $selected = 'DESC'; // Check for a custom sort_order. if ( !empty( $_REQUEST['sort_order'] ) ) { if ( in_array( $_REQUEST['sort_order'], $orders ) ) { $selected = $_REQUEST['sort_order']; } } ?> <form action="" method="get" id="notifications-sort-order"> <label for="notifications-sort-order-list"><?php esc_html_e( 'Order By:', 'buddyboss' ); ?></label> <select id="notifications-sort-order-list" name="sort_order" onchange="this.form.submit();"> <option value="DESC" <?php selected( $selected, 'DESC' ); ?>><?php _e( 'Newest First', 'buddyboss' ); ?></option> <option value="ASC" <?php selected( $selected, 'ASC' ); ?>><?php _e( 'Oldest First', 'buddyboss' ); ?></option> </select> <noscript> <input id="submit" type="submit" name="form-submit" class="submit" value="<?php esc_attr_e( 'Go', 'buddyboss' ); ?>" /> </noscript> </form> <?php }
Changelog
Version | Description |
---|---|
BuddyPress 1.9.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.