bbp_exclude_forum_ids($ type.='细绳'的)
返回meta_query,其包含或排除查询中的隐藏论坛ID。
描述
参数
-
(细绳的)(可选的)要返回的值类型。(String | Array | Meta_Query)
来源
函数bbp_exclude_forum_ids($ type ='string'){// setup arrays $ private = $ hidden = $ meta_query = $ forum_ids = array();//默认返回值交换机($ type){案例'字符串':$ retval ='';休息;案例'数组':$ retval = array();休息;案例'meta_query':$ retval = array(array());休息;} //为每个人排除,但如果(!bbp_is_user_keymaster())){//私有论坛if(!current_user_can('read_private_forums'))$ private = bbp_get_private_forum_ids();//隐藏论坛if(!current_user_can('read_hidden_forums'))$ hidden = bbp_get_hidden_forum_ids();//将私有和隐藏论坛合并在一起$ forum_ids =(array)array_filter(wp_parse_id_list(array_merge($私人,$ hidden))); // There are forums that need to be excluded if ( !empty( $forum_ids ) ) { switch ( $type ) { // Separate forum ID's into a comma separated string case 'string' : $retval = implode( ',', $forum_ids ); break; // Use forum_ids array case 'array' : $retval = $forum_ids; break; // Build a meta_query case 'meta_query' : $retval = array( 'key' => '_bbp_forum_id', 'value' => implode( ',', $forum_ids ), 'type' => 'numeric', 'compare' => ( 1 < count( $forum_ids ) ) ? 'NOT IN' : '!=' ); break; } } } // Filter and return the results return apply_filters( 'bbp_exclude_forum_ids', $retval, $forum_ids, $type ); }
变更乐
版本 | 描述 |
---|---|
Bbpress(R3291) | 介绍。 |