Changeset 8066
- Timestamp:
- 03/06/2014 07:22:16 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-template.php
r8063 r8066 2929 2929 var $total_request_count; 2930 2930 2931 function __construct( $group_id, $per_page, $max ) { 2931 /** 2932 * Constructor method. 2933 * 2934 * @param array $args { 2935 * @type int $group_id ID of the group whose membership requests 2936 * are being queried. Default: current group id. 2937 * @type int $per_page Number of records to return per page of 2938 * results. Default: 10. 2939 * @type int $max Max items to return. Default: false (show all) 2940 * } 2941 */ 2942 function __construct( $args = array() ) { 2943 2944 // Backward compatibility with old method of passing arguments 2945 if ( ! is_array( $args ) || func_num_args() > 1 ) { 2946 _deprecated_argument( __METHOD__, '2.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) ); 2947 2948 $old_args_keys = array( 2949 0 => 'group_id', 2950 1 => 'per_page', 2951 2 => 'max', 2952 ); 2953 2954 $func_args = func_get_args(); 2955 $args = bp_core_parse_args_array( $old_args_keys, $func_args ); 2956 } 2957 2958 $r = wp_parse_args( $args, array( 2959 'group_id' => bp_get_current_group_id(), 2960 'per_page' => 10, 2961 'max' => false, 2962 ) ); 2932 2963 2933 2964 $this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : 1; 2934 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $ per_page;2935 $this->requests = BP_Groups_Group::get_membership_requests( $ group_id, $this->pag_num, $this->pag_page );2936 2937 if ( !$ max || $max>= (int) $this->requests['total'] )2965 $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'] ) 2938 2969 $this->total_request_count = (int) $this->requests['total']; 2939 2970 else 2940 $this->total_request_count = (int) $ max;2971 $this->total_request_count = (int) $r['max']; 2941 2972 2942 2973 $this->requests = $this->requests['requests']; 2943 2974 2944 if ( $ max) {2945 if ( $ max>= count($this->requests) )2975 if ( $r['max'] ) { 2976 if ( $r['max'] >= count($this->requests) ) 2946 2977 $this->request_count = count($this->requests); 2947 2978 else 2948 $this->request_count = (int) $ max;2979 $this->request_count = (int) $r['max']; 2949 2980 } else { 2950 2981 $this->request_count = count($this->requests); … … 3015 3046 3016 3047 $r = wp_parse_args( $args, $defaults ); 3017 extract( $r, EXTR_SKIP ); 3018 3019 $requests_template = new BP_Groups_Membership_Requests_Template( $group_id, $per_page, $max ); 3048 3049 $requests_template = new BP_Groups_Membership_Requests_Template( $r ); 3020 3050 return apply_filters( 'bp_group_has_membership_requests', $requests_template->has_requests(), $requests_template ); 3021 3051 }
Note: See TracChangeset
for help on using the changeset viewer.