Changeset 11142 for trunk/src/bp-groups/bp-groups-functions.php
- Timestamp:
- 09/21/2016 06:00:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-functions.php
r11100 r11142 2248 2248 * 2249 2249 * @since 2.6.0 2250 * 2251 * @param int $group ID of the group. 2252 * @param string $group_type Group type. 2253 * @param bool $append Optional. True to append this to existing types for group, 2254 * false to replace. Default: false. 2250 * @since 2.7.0 $group_type parameter also accepts an array of group types now. 2251 * 2252 * @param int $group ID of the group. 2253 * @param string|array $group_type Group type or array of group types to set. 2254 * @param bool $append Optional. True to append this to existing types for group, 2255 * false to replace. Default: false. 2255 2256 * @return array $retval See bp_set_object_terms(). 2256 2257 */ 2257 2258 function bp_groups_set_group_type( $group_id, $group_type, $append = false ) { 2258 2259 // Pass an empty group type to remove group's type. 2259 if ( ! empty( $group_type ) && ! bp_groups_get_group_type_object( $group_type ) ) { 2260 return false; 2260 if ( ! empty( $group_type ) && is_string( $group_type ) && ! bp_groups_get_group_type_object( $group_type ) ) { 2261 return false; 2262 } 2263 2264 // Cast as array. 2265 $group_type = (array) $group_type; 2266 2267 // Validate group types. 2268 foreach ( $group_type as $type ) { 2269 // Remove any invalid group types. 2270 if ( is_null( bp_groups_get_group_type_object( $type ) ) ) { 2271 unset( $group_type[ $type ] ); 2272 } 2261 2273 } 2262 2274 … … 2272 2284 * @since 2.6.0 2273 2285 * 2274 * @param int $group_id ID of the group whose group type has been updated.2275 * @param string $group_type Group type.2276 * @param bool $append Whether the type is being appended to existing types.2286 * @param int $group_id ID of the group whose group type has been updated. 2287 * @param string|array $group_type Group type or array of group types. 2288 * @param bool $append Whether the type is being appended to existing types. 2277 2289 */ 2278 2290 do_action( 'bp_groups_set_group_type', $group_id, $group_type, $append );
Note: See TracChangeset
for help on using the changeset viewer.