Changeset 6426
- Timestamp:
- 05/26/2017 09:22:47 PM (9 years ago)
- Location:
- trunk/src/includes/forums
- Files:
-
- 2 edited
-
capabilities.php (modified) (1 diff)
-
functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/capabilities.php
r6425 r6426 270 270 * - `bbp_get_hidden_forum_ids()` 271 271 * 272 * @since 2.6.0 bbPress (r642 2)272 * @since 2.6.0 bbPress (r6426) 273 273 * 274 274 * @param array $forum_ids Forum IDs to check if the user ID is a moderator of -
trunk/src/includes/forums/functions.php
r6415 r6426 2082 2082 2083 2083 /** 2084 * Returns the forum IDs that should be excluded from various views & queries, 2085 * based on the current user's capabilities. 2086 * 2087 * @since 2.6.0 bbPress (r6425) 2088 * 2089 * @return array Forum IDs to exclude, or an empty array 2090 */ 2091 function bbp_get_excluded_forum_ids() { 2092 2093 // Private forums 2094 $private = ! current_user_can( 'read_private_forums' ) 2095 ? bbp_get_private_forum_ids() 2096 : array(); 2097 2098 // Hidden forums 2099 $hidden = ! current_user_can( 'read_hidden_forums' ) 2100 ? bbp_get_hidden_forum_ids() 2101 : array(); 2102 2103 // Merge private & hidden forums together, and remove any empties 2104 $forum_ids = ( ! empty( $private ) || ! empty( $hidden ) ) 2105 ? array_filter( wp_parse_id_list( array_merge( $private, $hidden ) ) ) 2106 : array(); 2107 2108 // Filter & return 2109 return (array) apply_filters( 'bbp_get_excluded_forum_ids', $forum_ids, $private, $hidden ); 2110 } 2111 2112 /** 2084 2113 * Returns a meta_query that either includes or excludes hidden forum IDs 2085 2114 * from a query. … … 2118 2147 if ( ! bbp_is_user_keymaster() ) { 2119 2148 2120 // Private forums 2121 $private = ! current_user_can( 'read_private_forums' ) 2122 ? bbp_get_private_forum_ids() 2123 : array(); 2124 2125 // Hidden forums 2126 $hidden = ! current_user_can( 'read_hidden_forums' ) 2127 ? bbp_get_hidden_forum_ids() 2128 : array(); 2129 2130 // Merge private and hidden forums together and remove any empties 2131 $forum_ids = ( ! empty( $private ) || ! empty( $hidden ) ) 2132 ? array_filter( wp_parse_id_list( array_merge( $private, $hidden ) ) ) 2133 : array(); 2134 2135 // Comparison 2136 $compare = ( 1 < count( $forum_ids ) ) 2137 ? 'NOT IN' 2138 : '!='; 2149 // Get forum IDs to exclude 2150 $forum_ids = bbp_get_excluded_forum_ids(); 2139 2151 2140 2152 // Store return values in static types array 2141 2153 if ( ! empty( $forum_ids ) ) { 2154 2155 // Comparison 2156 $compare = ( 1 < count( $forum_ids ) ) 2157 ? 'NOT IN' 2158 : '!='; 2159 2160 // Setup types 2142 2161 $types['array'] = $forum_ids; 2143 2162 $types['string'] = implode( ',', $forum_ids );
Note: See TracChangeset
for help on using the changeset viewer.