Changeset 7930 for trunk/bp-groups/bp-groups-template.php
- Timestamp:
- 02/18/2014 09:44:25 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-template.php
r7897 r7930 1933 1933 var $total_group_count; 1934 1934 1935 function __construct( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude, $group_role = false ) { 1935 /** 1936 * Constructor. 1937 * 1938 * @param array $args { 1939 * An array of optional arguments. 1940 * @type int $group_id ID of the group whose members are being 1941 * queried. Default: current group ID. 1942 * @type int $page Page of results to be queried. Default: 1. 1943 * @type int $per_page Number of items to return per page of 1944 * results. Default: 20. 1945 * @type int $max Optional. Max number of items to return. 1946 * @type array $exclude Optional. Array of user IDs to exclude. 1947 * @type bool|int True (or 1) to exclude admins and mods from 1948 * results. Default: 1. 1949 * @type bool|int True (or 1) to exclude banned users from results. 1950 * Default: 1. 1951 * @type array $group_role Optional. Array of group roles to include. 1952 * @type string $search_terms Optional. Search terms to match. 1953 * } 1954 */ 1955 function __construct( $args = array() ) { 1956 1957 // Backward compatibility with old method of passing arguments 1958 if ( ! is_array( $args ) || func_num_args() > 1 ) { 1959 _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__ ) ); 1960 1961 $old_args_keys = array( 1962 0 => 'group_id', 1963 1 => 'per_page', 1964 2 => 'max', 1965 3 => 'exclude_admins_mods', 1966 4 => 'exclude_banned', 1967 5 => 'exclude', 1968 6 => 'group_role', 1969 ); 1970 1971 $func_args = func_get_args(); 1972 $args = bp_core_parse_args_array( $old_args_keys, $func_args ); 1973 } 1974 1975 $r = wp_parse_args( $args, array( 1976 'group_id' => bp_get_current_group_id(), 1977 'page' => 1, 1978 'per_page' => 20, 1979 'max' => false, 1980 'exclude' => false, 1981 'exclude_admins_mods' => 1, 1982 'exclude_banned' => 1, 1983 'group_role' => false, 1984 'search_terms' => false, 1985 ) ); 1986 1987 // @todo No 1988 extract( $r ); 1936 1989 1937 1990 $this->pag_page = isset( $_REQUEST['mlpage'] ) ? intval( $_REQUEST['mlpage'] ) : 1; 1938 1991 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 1939 $this->members = groups_get_group_members( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned, $exclude, $group_role ); 1992 1993 $members_args = $r; 1994 1995 $members_args['page'] = $this->pag_page; 1996 $members_args['per_page'] = $this->pag_num; 1997 1998 $this->members = groups_get_group_members( $members_args ); 1940 1999 1941 2000 if ( !$max || $max >= (int) $this->members['count'] ) … … 2010 2069 } 2011 2070 2071 /** 2072 * Initialize a group member query loop. 2073 * 2074 * @param array $args { 2075 * An array of optional arguments. 2076 * @type int $group_id ID of the group whose members are being queried. 2077 * Default: current group ID. 2078 * @type int $page Page of results to be queried. Default: 1. 2079 * @type int $per_page Number of items to return per page of results. 2080 * Default: 20. 2081 * @type int $max Optional. Max number of items to return. 2082 * @type array $exclude Optional. Array of user IDs to exclude. 2083 * @type bool|int True (or 1) to exclude admins and mods from results. 2084 * Default: 1. 2085 * @type bool|int True (or 1) to exclude banned users from results. 2086 * Default: 1. 2087 * @type array $group_role Optional. Array of group roles to include. 2088 * @type string $search_terms Optional. Search terms to match. 2089 * } 2090 */ 2012 2091 function bp_group_has_members( $args = '' ) { 2013 2092 global $members_template; 2014 2093 2015 2094 $r = wp_parse_args( $args, array( 2016 'group_id' => bp_get_current_group_id(), 2017 'per_page' => 20, 2018 'max' => false, 2019 'exclude' => false, 2095 'group_id' => bp_get_current_group_id(), 2096 'page' => 1, 2097 'per_page' => 20, 2098 'max' => false, 2099 'exclude' => false, 2020 2100 'exclude_admins_mods' => 1, 2021 'exclude_banned' => 1, 2022 'group_role' => false, 2101 'exclude_banned' => 1, 2102 'group_role' => false, 2103 'search_terms' => false, 2023 2104 ) ); 2024 2105 2025 $members_template = new BP_Groups_Group_Members_Template( $r['group_id'], $r['per_page'], $r['max'], (int) $r['exclude_admins_mods'], (int) $r['exclude_banned'], $r['exclude'], $r['group_role'] ); 2106 if ( empty( $r['search_terms'] ) && ! empty( $_REQUEST['s'] ) ) 2107 $r['search_terms'] = $_REQUEST['s']; 2108 2109 $members_template = new BP_Groups_Group_Members_Template( $r ); 2026 2110 return apply_filters( 'bp_group_has_members', $members_template->has_members(), $members_template ); 2027 2111 }
Note: See TracChangeset
for help on using the changeset viewer.