How do I find the bbpress forum ID for a forum in a buddypress group?
I am trying to modify this code https://www.daggerhart.com/bbpress-recent-replies-shortcode/ but I have specific questions and cannot find the answer. This code above generates a shortcode like [bbpress_recent_replies_by_topic show=10 forum=123]
I have a buddypress site with groups, and each group has its own bbpress forum. I want to list the recent replies for the forum assigned to that group (only) when a user visits the group page. So basically I want to assign the forum ID based on whichever group the user is in and is seeing the widget in.
This is the function in the code above:
function custom_bbpress_recent_replies_by_topic($atts){
$short_array = shortcode_atts(array('show' = 5, 'forum' = false, 'include_empty_topics' = false), $atts);
extract($short_array);
Instead of 'forum' = false
, I want it to point to 'forum' = _bbp_forum_id
or something like that. However, that doesn't work because I'm at the group home page so there is no forum there yet until you click "forums" in the group menu. I don't know how database links the budddypress group to the bbpress forum id.
Some questions: 1) How do I find out the forum id for the group’s assigned forum? Is it _bbp_forum_id ? 2) How do I then assign that forum ID to to be the default forum ID for the widget in the code above?
Topic bbpress buddypress Wordpress
Category Web