Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/24/2014 07:11:16 PM (10 years ago)
Author:
boonebgorges
Message:

Add AJAX-powered pagination for group membership requests admin pages

Fixes #5440

Props dcavins

File:
1 edited

Legend:

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

    r8142 r8150  
    30743074 */
    30753075function bp_group_has_membership_requests( $args = '' ) {
    3076     global $requests_template, $groups_template;
     3076    global $requests_template;
    30773077
    30783078    $defaults = array(
    3079         'group_id' => $groups_template->group->id,
     3079        'group_id' => bp_get_current_group_id(),
    30803080        'per_page' => 10,
    30813081        'page'     => 1,
     
    31113111}
    31123112    function bp_get_group_request_reject_link() {
    3113         global $requests_template, $groups_template;
    3114 
    3115         return apply_filters( 'bp_get_group_request_reject_link', wp_nonce_url( bp_get_group_permalink( $groups_template->group ) . 'admin/membership-requests/reject/' . $requests_template->request->id, 'groups_reject_membership_request' ) );
     3113        global $requests_template;
     3114
     3115        return apply_filters( 'bp_get_group_request_reject_link', wp_nonce_url( bp_get_group_permalink( groups_get_current_group() ) . 'admin/membership-requests/reject/' . $requests_template->request->membership_id, 'groups_reject_membership_request' ) );
    31163116    }
    31173117
     
    31203120}
    31213121    function bp_get_group_request_accept_link() {
    3122         global $requests_template, $groups_template;
    3123 
    3124         return apply_filters( 'bp_get_group_request_accept_link', wp_nonce_url( bp_get_group_permalink( $groups_template->group ) . 'admin/membership-requests/accept/' . $requests_template->request->id, 'groups_accept_membership_request' ) );
     3122        global $requests_template;
     3123
     3124        return apply_filters( 'bp_get_group_request_accept_link', wp_nonce_url( bp_get_group_permalink( groups_get_current_group() ) . 'admin/membership-requests/accept/' . $requests_template->request->membership_id, 'groups_accept_membership_request' ) );
    31253125    }
    31263126
     
    31453145    echo apply_filters( 'bp_group_request_comment', strip_tags( stripslashes( $requests_template->request->comments ) ) );
    31463146}
     3147
     3148/**
     3149 * Output pagination links for group membership requests.
     3150 *
     3151 * @since BuddyPress (2.0.0)
     3152 */
     3153function bp_group_requests_pagination_links() {
     3154    echo bp_get_group_requests_pagination_links();
     3155}
     3156    /**
     3157     * Get pagination links for group membership requests.
     3158     *
     3159     * @since BuddyPress (2.0.0)
     3160     *
     3161     * @return string
     3162     */
     3163    function bp_get_group_requests_pagination_links() {
     3164        global $requests_template;
     3165        return apply_filters( 'bp_get_group_requests_pagination_links', $requests_template->pag_links );
     3166    }
     3167
     3168/**
     3169 * Output pagination count text for group membership requests.
     3170 *
     3171 * @since BuddyPress (2.0.0)
     3172 */
     3173function bp_group_requests_pagination_count() {
     3174    echo bp_get_group_requests_pagination_count();
     3175}
     3176    /**
     3177     * Get pagination count text for group membership requests.
     3178     *
     3179     * @since BuddyPress (2.0.0)
     3180     *
     3181     * @return string
     3182     */
     3183    function bp_get_group_requests_pagination_count() {
     3184        global $requests_template;
     3185
     3186        $start_num = intval( ( $requests_template->pag_page - 1 ) * $requests_template->pag_num ) + 1;
     3187        $from_num  = bp_core_number_format( $start_num );
     3188        $to_num    = bp_core_number_format( ( $start_num + ( $requests_template->pag_num - 1 ) > $requests_template->total_request_count ) ? $requests_template->total_request_count : $start_num + ( $requests_template->pag_num - 1 ) );
     3189        $total     = bp_core_number_format( $requests_template->total_request_count );
     3190
     3191        return apply_filters( 'bp_get_group_requests_pagination_count', sprintf( _n( 'Viewing requests %1$s to %2$s (of %3$s request)', 'Viewing request %1$s to %2$s (of %3$s requests)', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
     3192    }
    31473193
    31483194/************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.