Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2014 02:50:45 PM (11 years ago)
Author:
boonebgorges
Message:

Introduce pagination for Send Invites page in single groups

For better support for up-to-date pagination, the AJAX for group invitations
now refreshes the entire invitation section, rather than simply adding single
items to/removing single items from the DOM. This change requires a new
template, groups/single/invite-loop.php, which is the item loaded by the AJAX
request. Backward compatibility with bp-default-style themes is maintained in
the JS.

Fixes #5423

Props dcavins

File:
1 edited

Legend:

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

    r8062 r8063  
    33193319    }
    33203320
     3321/**
     3322 * Output pagination links for group invitations.
     3323 *
     3324 * @since BuddyPress (2.0.0)
     3325 */
     3326function bp_group_invite_pagination_links() {
     3327    echo bp_get_group_invite_pagination_links();
     3328}
     3329    /**
     3330     * Get pagination links for group invitations.
     3331     *
     3332     * @since BuddyPress (2.0.0)
     3333     *
     3334     * @return string
     3335     */
     3336    function bp_get_group_invite_pagination_links() {
     3337        global $invites_template;
     3338        return apply_filters( 'bp_get_group_invite_pagination_links', $invites_template->pag_links );
     3339    }
     3340
     3341/**
     3342 * Output pagination count text for group invitations.
     3343 *
     3344 * @since BuddyPress (2.0.0)
     3345 */
     3346function bp_group_invite_pagination_count() {
     3347    echo bp_get_group_invite_pagination_count();
     3348}
     3349    /**
     3350     * Get pagination count text for group invitations.
     3351     *
     3352     * @since BuddyPress (2.0.0)
     3353     *
     3354     * @return string
     3355     */
     3356    function bp_get_group_invite_pagination_count() {
     3357        global $invites_template;
     3358
     3359        $start_num = intval( ( $invites_template->pag_page - 1 ) * $invites_template->pag_num ) + 1;
     3360        $from_num  = bp_core_number_format( $start_num );
     3361        $to_num    = bp_core_number_format( ( $start_num + ( $invites_template->pag_num - 1 ) > $invites_template->total_invite_count ) ? $invites_template->total_invite_count : $start_num + ( $invites_template->pag_num - 1 ) );
     3362        $total     = bp_core_number_format( $invites_template->total_invite_count );
     3363
     3364        return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing invitation %1$s to %2$s (of %3$s invitation)', 'Viewing invitation %1$s to %2$s (of %3$s invitations)', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
     3365    }
     3366
    33213367/***
    33223368 * Groups RSS Feed Template Tags
Note: See TracChangeset for help on using the changeset viewer.