bp_groups_exclude_forums_by_group_type_args( $args_forum )
Exclude Forums from forum loop if any forum is attached to a group and that group have a group type and that group type is hidden from the directory page.
Description
Parameters
- $args_forum
-
(Required)
Return
(mixed) $args_forum
Source
File: bp-groups/bp-groups-filters.php
function bp_groups_exclude_forums_by_group_type_args( $args_forum ) { if ( bbp_is_forum_archive() || bbp_is_topic_archive() ) { $exclude_forum_ids = array(); // Check group type enabled if ( true === bp_disable_group_type_creation() ) { // Get excluded group ids. $exclude_group_ids = array_unique( bp_groups_get_excluded_group_ids_by_type() ); foreach ( $exclude_group_ids as $exclude_group_id ) { // Get forums id by group id. $exclude_forum_ids_by_group = bbp_get_group_forum_ids( (int) $exclude_group_id ); foreach ( $exclude_forum_ids_by_group as $exclude_id ) { // Set $exclude_forum_ids array. $exclude_forum_ids[] = $exclude_id; } } } if ( isset( $exclude_forum_ids ) && ! empty( $exclude_forum_ids ) ) { $args_forum['post__not_in'] = $exclude_forum_ids; } } return $args_forum; }
Changelog
Version | Description |
---|---|
BuddyBoss 1.1.9 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.