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

设置文档参数,以便在' public '作用域中使用。

描述

参数

retval美元

数组(可选)默认为空数组。

默认值:数组()

美元的过滤器

数组(可选)当前活动的观点。

默认值:数组()

返回

(数组)

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

function bp_members_filter_document_public_scope($retval = array(), $filter = array()){//确定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;数组$文件夹= ();如果(!$filter['folder_id'] = (int) $filter['folder_id'];} if (! empty( $filter['search_terms'] ) ) { if ( ! empty( $folder_id ) ) { $folder_ids = array(); $user_root_folder_ids = bp_document_get_folder_children( (int) $folder_id ); if ( $user_root_folder_ids ) { foreach ( $user_root_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' => 'folder_id', 'compare' => 'IN', 'value' => $folder_ids, ); } } else { $folders = array( 'column' => 'folder_id', 'compare' => '=', 'value' => '0', ); } $privacy = array( 'public' ); if ( is_user_logged_in() ) { $privacy[] = 'loggedin'; } $args = array( 'relation' => 'AND', array( 'column' => 'privacy', 'compare' => 'IN', 'value' => $privacy ), array( 'column' => 'group_id', 'compare' => '=', 'value' => '0', ), $folders ); if ( ! bp_is_profile_document_support_enabled() ) { $args[] = array( 'column' => 'user_id', 'compare' => '=', 'value' => '0', ); } return $args; }

更新日志

更新日志
版本 描述
BuddyBoss 1.4.4 介绍了。

问题吗?

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