Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Grab topic IDs from forum ID

@alexstine

Participant

Hello,

Okay, I like something that doesn’t query the DB to much. Would something like this work? I’m somewhat new to arrays and post_meta, but trying to learn fast.

/*Remove all topics from Amazon CloudSearch if topic is in a private forum*/
/*Private Forums are added as an integration through a plugin*/
/*Amazon CloudSearch is added as integration through a plugin*/
function exclude_topics_in_private_forum() {
$forum_id = bbp_get_forum_id();
$query = bbp_get_all_child_ids($forum_id, 'post');
foreach($query as $q) {
OR
foreach($query as $key => $q) {
if(is_private_forum($forum_id) ) {
update_post_meta($q, 'exclude', 1);
OR
update_post_meta($key, 'exclude', 1);
} elseif(!is_private_forum($forum_id) ) {
delete_post_meta($q, 'exclude');
}
}
}
add_action('bbp_new_forum', 'exclude_topics_in_private_forum' );
add_action('bbp_edit_forum', 'exclude_topics_in_private_forum' );

How does that look? Any suggestions?

Thanks.

Skip to toolbar