bbp_publicize_forum (intforum_id美元,current_visibility美元='')
将论坛标记为公众论坛
描述
参数
- forum_id美元
-
(int)(可选)论坛id
返回
(保龄球)失败时虚伪,成功时真实
源
函数bbp_publicize_forum($forum_id = 0, $current_visibility = ") {$forum_id = bbp_get_forum_id($forum_id);Do_action ('bbp_publicize_forum', $forum_id);//获取私有论坛$private = bbp_get_private_forum_ids();//在数组中查找论坛if (in_array($forum_id, $private)) {$offset = array_search($forum_id, $private);array_splice($private, $offset, 1);//更新私有论坛减去这个update_option('_bbp_private_forums', array_unique(array_filter(array_values($private))));} //获取隐藏论坛$hidden = bbp_get_hidden_forum_ids();//在数组中查找论坛if (in_array($forum_id, $hidden)) {$offset = array_search($forum_id, $hidden);array_splice($hidden, $offset, 1);//更新隐藏的论坛减去这个update_option('_bbp_hidden_forums', array_unique(array_filter(array_values($hidden)))); } // Only run queries if visibility is changing if ( bbp_get_public_status_id() !== $current_visibility ) { // Update forums visibility setting global $wpdb; $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_public_status_id() ), array( 'ID' => $forum_id ) ); wp_transition_post_status( bbp_get_public_status_id(), $current_visibility, get_post( $forum_id ) ); bbp_clean_post_cache( $forum_id ); } do_action( 'bbp_publicized_forum', $forum_id ); return $forum_id; }
更新日志
版本 | 描述 |
---|---|
bbPress (r2746) | 介绍了。 |