bp_groups_filter_folder_scope (retval美元数组()美元的过滤器数组()

描述

文件:bp-groups / bp-groups-filters.php

函数bp_groups_filter_folder_scope($retval = array(), $filter = array()) {if (!Bp_is_group_document_support_enabled()){返回$retval;} //确定user_id。如果(!空(过滤器[' user_id美元 '] ) ) { $ user_id = $过滤器(“user_id”);} else {$user_id = bp_displayed_user_id() ?bp_displayed_user_id (): bp_loggedin_user_id ();} $folder_id = 0;数组$文件夹= ();如果(! empty( $filter['folder_id'] ) ) { $folder_id = (int) $filter['folder_id']; } if ( 'groups' !== $filter['scope'] ) { // Fetch public groups. $public_groups = groups_get_groups( array( 'fields' => 'ids', 'status' => 'public', 'per_page' => - 1, ) ); } if ( ! empty( $public_groups['groups'] ) ) { $public_groups = $public_groups['groups']; } else { $public_groups = array(); } // Determine groups of user. $groups = groups_get_user_groups( $user_id ); if ( ! empty( $groups['groups'] ) ) { $groups = $groups['groups']; } else { $groups = array(); } $group_ids = false; if ( ! empty( $groups ) && ! empty( $public_groups ) ) { $group_ids = array( 'groups' => array_unique( array_merge( $groups, $public_groups ) ) ); } elseif ( empty( $groups ) && ! empty( $public_groups ) ) { $group_ids = array( 'groups' => $public_groups ); } elseif ( ! empty( $groups ) && empty( $public_groups ) ) { $group_ids = array( 'groups' => $groups ); } if ( empty( $group_ids ) ) { $group_ids = array( 'groups' => array() ); } if ( bp_is_group() ) { $group_ids = array( 'groups' => array( bp_get_current_group_id() ) ); } if ( ! empty( $filter['search_terms'] ) ) { if ( ! empty( $folder_id ) ) { $folder_ids = array(); $fetch_folder_ids = bp_document_get_folder_children( (int) $folder_id ); if ( $fetch_folder_ids ) { foreach ( $fetch_folder_ids as $single_folder ) { $single_folder_ids = bp_document_get_folder_children( (int) $single_folder ); if ( $single_folder_ids ) { array_merge( $folder_ids, $single_folder_ids ); } array_push( $folder_ids, $single_folder ); } } $folder_ids[] = $folder_id; $folders = array( 'column' => 'parent', 'compare' => 'IN', 'value' => $folder_ids, ); } } else { if ( ! empty( $folder_id ) ) { $folders = array( 'column' => 'parent', 'compare' => '=', 'value' => $folder_id, ); } else { $folders = array( 'column' => 'parent', 'value' => 0, ); } } $args = array( 'relation' => 'AND', array( 'column' => 'group_id', 'compare' => 'IN', 'value' => (array) $group_ids['groups'], ), array( 'column' => 'privacy', 'value' => 'grouponly', ), $folders, ); return $args; }

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队