Changeset 8069 for trunk/bp-groups/bp-groups-template.php
- Timestamp:
- 03/06/2014 07:58:49 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-template.php
r8066 r8069 2937 2937 * @type int $per_page Number of records to return per page of 2938 2938 * results. Default: 10. 2939 * @type int $page Page of results to show. Default: 1. 2939 2940 * @type int $max Max items to return. Default: false (show all) 2940 2941 * } … … 2959 2960 'group_id' => bp_get_current_group_id(), 2960 2961 'per_page' => 10, 2961 'max' => false, 2962 'page' => 1, 2963 'max' => false, 2964 'type' => 'first_joined', 2962 2965 ) ); 2963 2966 2964 $this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : 1;2967 $this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : $r['page']; 2965 2968 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $r['per_page']; 2966 $this->requests = BP_Groups_Group::get_membership_requests( $r['group_id'], $this->pag_num, $this->pag_page ); 2967 2968 if ( !$r['max'] || $r['max'] >= (int) $this->requests['total'] ) 2969 $this->total_request_count = (int) $this->requests['total']; 2969 2970 $mquery = new BP_Group_Member_Query( array( 2971 'group_id' => $r['group_id'], 2972 'type' => $r['type'], 2973 'per_page' => $this->pag_num, 2974 'page' => $this->pag_page, 2975 2976 // These filters ensure we only get pending requests 2977 'is_confirmed' => false, 2978 'inviter_id' => 0, 2979 ) ); 2980 2981 $this->requests = array_values( $mquery->results ); 2982 $this->request_count = count( $this->requests ); 2983 2984 // Compatibility with legacy format of request data objects 2985 foreach ( $this->requests as $rk => $rv ) { 2986 // For legacy reasons, the 'id' property of each 2987 // request must match the membership id, not the ID of 2988 // the user (as it's returned by BP_Group_Member_Query) 2989 $this->requests[ $rk ]->user_id = $rv->ID; 2990 $this->requests[ $rk ]->id = $rv->membership_id; 2991 2992 // Miscellaneous values 2993 $this->requests[ $rk ]->group_id = $r['group_id']; 2994 } 2995 2996 if ( !$r['max'] || $r['max'] >= (int) $mquery->total_users ) 2997 $this->total_request_count = (int) $mquery->total_users; 2970 2998 else 2971 2999 $this->total_request_count = (int) $r['max']; 2972 2973 $this->requests = $this->requests['requests'];2974 3000 2975 3001 if ( $r['max'] ) { … … 3036 3062 } 3037 3063 3064 /** 3065 * Initialize a group membership request template loop. 3066 * 3067 * @param array $args { 3068 * @type int $group_id ID of the group. Defaults to current group. 3069 * @type int $per_page Number of records to return per page. Default: 10. 3070 * @type int $page Page of results to return. Default: 1. 3071 * @type int $max Max number of items to return. Default: false. 3072 * } 3073 * @return bool True if there are requests, otherwise false. 3074 */ 3038 3075 function bp_group_has_membership_requests( $args = '' ) { 3039 3076 global $requests_template, $groups_template; … … 3042 3079 'group_id' => $groups_template->group->id, 3043 3080 'per_page' => 10, 3081 'page' => 1, 3044 3082 'max' => false 3045 3083 );
Note: See TracChangeset
for help on using the changeset viewer.