Forum Replies Created
-
In reply to: Grab topic IDs from forum ID
Looking back on it now, I never did have the development time to make this work before I discontinued CloudSearch, but this looks to be the best code if anyone’s brave enough to try it in the future. 🙂
function exclude_topics_in_private_forum() { $forum_id = bbp_get_forum_id(); $query = bbp_get_all_child_ids($forum_id, 'post'); foreach($query as $key => $q) { if(is_private_forum($forum_id) ) { 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' );
Thanks for the help.
In reply to: Update pagination valuesHello,
I started to work on the code and then got my bill. That’s when I instantly stopped using CloudSearch. It’s a good starting place though. If I ever revisit CloudSearch in the future, I’m coming back for the code.
Thanks for the help.
In reply to: Grab topic IDs from forum IDHello,
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.
In reply to: Grab topic IDs from forum IDHello @robin-w,
I still need to get this straight. Maybe something like this would work?
/*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_has_topics( array( 'post_parent' => $forum_id) ); foreach($query as $q) { if(is_private_forum($forum_id) ) { update_post_meta($q, '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' );
It is important to note that I am using custom plugins to pull off a lot of the private forum abilities that way I can control user access better. I think the code snippet above will do it. Thoughts?
Thanks.
In reply to: Update pagination valuesIn reply to: Update pagination valuesHello @robin-w,
It’s this text at the top and bottom of single forums.
“Viewing 4 topics – 1 through 4 (of 4 total)”
Thanks.
In reply to: Update pagination valuesHello @robin-w,
I’m not using a default bbPress function to hide the topics. I’m using a custom plugin to handle the hiding of topics so members who are participants have a choice if they want the topic to be public to all members or private to moderators and keymasters. As you can see with the code above, that excludes the custom private topics from search results. Now what I need to do is update the pagination counts.
For example, there’s a topic named “Testing” and another topic named “test123”. Pagination will show 2 topics. If “testing” is now marked private, pagination will show 2 topics. I need to figure out a way to update the pagination so it only shows 1 topic since that’s all is showing to participants. However if a moderator comes along with the required permission to view a private topic, the pagination should still show 2 topics since the moderator has permission to see the private topic.
I hope this helps explain my goal.
Thanks.
In reply to: Update pagination valuesHello,
Any ideas on this one? I really have no ideas here.
Thanks.
In reply to: Grab topic IDs from forum IDHello,
Any ideas? Maybe something like this?
<?php echo bbp_get_forum_id(bbp_get_topic_id()); ?>
Thanks.
In reply to: List of Moderators and KeymastersOkay, thanks for the info. If anyone is interested in trying to create a solution, I’d appreciate it. For now, I’ll keep on with the research.
Thanks.
In reply to: Display Topic StatusThanks, posted there. We’ll see if a response comes.
In reply to: Show User Meta Field Below Display NameSorry about that, looks like I posted it in the wrong forum. Feel free to close or delete.Sorry LOL! LooksSorry