Hi Brajesh,
I am using BuddyBoss and have a forum associated with each group. Each forum has two subforums – Q&A and Wiki. The parent forum will be closed, so that discussions can only be created within the subforums.
I would like for the Group’s Discussions (slug = “forum”) tab to have a subnav that allows for selecting between the two subforums, but am having trouble achieving this.
If I make a tab to modify the existing tab, I cannot add subnavs. If I make a tab to remove the tab, then create a new one, I believe they will interfere with each other.
Also, I’m not sure how I would use the “Content” box for each subnav to dynamically present the correct subforum for each group.
Do you have any thoughts or recommendations for any of this?
Thanks!
Hi Nick,
Thank you for using the plugin.I am sorry, we will need couple of days to look into it and assit you as we are away on Diwali holidays.
Please allow us to assist you early next week.
Thank you
BrajeshHello Nick,
I have created a new forum tab with two child sub-forum names Q & A, Wiki. Please follow the screenshot for more details.
Regards
RaviThanks! Can you think of a way to dynamically set which forums are used? So, instead of hardcoding the id number 31, the ID would be set based on which group you are currently visiting?
I can probably figure out how to determine the IDs, I just need to know how to insert them into the tab’s content. Would it be best to create a custom shortcode snippet that generates the shortcode text?
e.g.
[bbp-group-wiki]
[bbp-group-qa]and those shortcodes then call a function that calls the following?
[bbp-single-forum id=$group_wiki]
[bbp-single-forum id=$group_QA]Hello Nick,
Try the following code. It will add a new column named “Shortcode” in the Forums list table screen admin section.
// Add the custom columns to the book post type: add_filter( 'bbp_admin_forums_column_headers', 'buddydev_add_shortcode_column' ); function buddydev_add_shortcode_column($columns) { $columns['shortcode'] = __( 'Shortcode' ); return $columns; } // Add the data to the custom columns for the book post type: add_action( 'manage_forum_posts_custom_column' , 'buddydev_render_shortcode_column', 10, 2 ); function buddydev_render_shortcode_column( $column, $post_id ) { switch ( $column ) { case 'shortcode' : echo "[bbp-single-forum id={$post_id}]"; break; } }
Regards
RaviThanks!
But its not clear to me how I am supposed to use this. I added it to a snippet and can’t find any “column” anywhere – whether it is in BuddyBoss’ backend Forums admin section, BuddyDev’s Group Tabs Creator Pro, or in the front end.
Also, I can’t find a hook named ‘manage_forum_posts_custom_column’ anywhere in my codebase.
Finally, how would I use this with a dynamic forum ID?
Hello Nick,
Please check the following screenshot:
https://www.awesomescreenshot.com/image/16480708?key=71a3d5104d8b5df28d5315361d81949f
‘manage_forum_posts_custom_column’ is a dynamic action for “manage_{$post_type}_posts_custom_column”
Actual hook
do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
Please check.
Regards
Ravi- This reply was modified 3 years ago by Ravi.
Hi Yogi, sorry I was busy for a while and wasn’t able to look into this until now. Unfortunately, the screenshot links are no longer active. Anyway, I dont think any of the above is relevant to what I was trying to achieve…
Again, what I have are a variety of groups, each of which have an associated Forum, each of which two subforums – Wiki and QA.
What I want is to place a single shortcode in the BuddyDev Group Tab Subnav’s content textbox that will dynamically identify and display the Wiki or QA subforum that is relevant to the currently viewed group.
The following appears to work:
function group_wiki_subnav (){ $groupID = bp_get_group_id(); $groupForum = groups_get_groupmeta($groupID, 'forum_id', true); $groupSubForum = bbp_forum_get_subforums($groupForum[0]); echo do_shortcode("[bbp-single-forum id=".$groupSubForum[1]->ID."]"); } add_shortcode ('group_wiki_subnav', 'group_wiki_subnav'); function group_qa_subnav (){ $groupID = bp_get_group_id(); $groupForum = groups_get_groupmeta($groupID, 'forum_id', true); $groupSubForum = bbp_forum_get_subforums($groupForum[0]); echo do_shortcode("[bbp-single-forum id=".$groupSubForum[0]->ID."]"); } add_shortcode ('group_qa_subnav', 'group_qa_subnav');
I use the two different shortcodes in their respective Subnav Content textbox and it seems to work. I may use a more robust way of identifying whether the subforum array item 0 or 1 contains QA or Wiki. Any suggestions are welcomed.
Hello Nick,
Please take a following code as a reference for your requiement. Just create a shortcode that will render content based on group actions like wiki, qa
add_shortcode( 'buddydev-tab-content', function ( $atts ) { if ( ! bp_is_group() ) { return ''; } $action = bp_action_variable( 0 ); if ( empty( $action ) ) { return ''; } $wiki_forum_id = 1; $qa_forum_id = 2; $shortcode = ''; // Slug should with your tab slug. if ( 'wiki' == $action ) { $shortcode = "[bbp-single-forum id={$wiki_forum_id}]"; } elseif ( 'qa' == $action ) { $shortcode = "[bbp-single-forum id={$qa_forum_id}]"; } ob_start(); echo do_shortcode( $shortcode ); return ob_get_clean(); } );
Please let me know if it helps you or not.
Regards
Ravi
You must be logged in to reply to this topic.