Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/08/2013 03:06:35 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Add pagination to notifications output. Includes functions for outputting and returning the count labels. See #5148.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-notifications/bp-notifications-template.php

    r7521 r7523  
    512512
    513513/**
    514  * Output the pagination for the current notification loop.
     514 * Output the pagination count for the current notification loop.
     515 *
     516 * @since BuddyPress (1.9.0)
     517 */
     518function bp_notifications_pagination_count() {
     519    echo bp_get_notifications_pagination_count();
     520}
     521    /**
     522     * Return the pagination count for the current notification loop.
     523     *
     524     * @since BuddyPress (1.9.0)
     525     *
     526     * @return string HTML for the pagination count.
     527     */
     528    function bp_get_notifications_pagination_count() {
     529        $query_loop = buddypress()->notifications->query_loop;
     530        $start_num  = intval( ( $query_loop->pag_page - 1 ) * $query_loop->pag_num ) + 1;
     531        $from_num   = bp_core_number_format( $start_num );
     532        $to_num     = bp_core_number_format( ( $start_num + ( $query_loop->pag_num - 1 ) > $query_loop->total_notification_count ) ? $query_loop->total_notification_count : $start_num + ( $query_loop->pag_num - 1 ) );
     533        $total      = bp_core_number_format( $query_loop->total_notification_count );
     534        $pag        = sprintf( _n( 'Viewing %1$s to %2$s (of %3$s notification)', 'Viewing %1$s to %2$s (of %3$s notifications)', $total, 'buddypress' ), $from_num, $to_num, $total );
     535
     536        return apply_filters( 'bp_notifications_pagination_count', $pag );
     537    }
     538
     539/**
     540 * Output the pagination links for the current notification loop.
    515541 *
    516542 * @since BuddyPress (1.9.0)
     
    520546}
    521547    /**
    522      * Return the pagination for the current notification loop.
    523      *
    524      * @since BuddyPress (1.9.0)
    525      *
    526      * @return string HTML for the pagination.
     548     * Return the pagination links for the current notification loop.
     549     *
     550     * @since BuddyPress (1.9.0)
     551     *
     552     * @return string HTML for the pagination links.
    527553     */
    528554    function bp_get_notifications_pagination_links() {
Note: See TracChangeset for help on using the changeset viewer.