Tagged: grouptabs
I would like to add a shortcode for a search form above the Discussions listings in BuddyBoss Groups’ Discussions tabs. However, when you check the box to modify a predefined tab, the subnav and its content field disappear.
The partial solution that I’ve found is:
1. Add a Group Tab that modifies the predefined Discussions tab (slug=”forum”) to be only visible to Site Admins
2. Add a Group Tab that displays what I need using shortcodes.However, I cannot use “forum” as the slug of the new tab because just gets hidden by the first tab. If I use another slug – e.g. forums – then when you click on a discussion topic it generates a 404 error because it is looking for “groups/{group name}/forum/discussion/{topic}”, which no longer exists.
So, it seems that the real solution would be
1. Ability to add a subnav and custom content to a predefined tab, which can either prepend, append or fully replace the default tab content. Taking this a bit further, the ability to add multiple subnavs to a predefined tab would be a bonus.
Or, perhaps easier:
2. Ability to fully disable a predefined tab, rather than just hide it, so that a new tab can use its slug, and any number of subnavs and custom content could be added.
I think there is value in both features, but the 2nd would probably be easier to implement.
Is any this possible in some way – either through updating the plugin or some custom snippet? Do you have any other suggested solutions?
Thanks!
An observation:
It turns out that I can add content to the predefined “forum” tab just by leaving it as-is and adding a new tab with the same “forum” slug and including the shortcode within its subnav content field.The result is that BuddyBoss seems to still populate its discussion topics, and the search form is appended to the bottom of the view. I’m not sure if that is how it is meant to work, but it is how it has turned out.
The only remaining problem is that I would like to PREpend to the top of the view it rather than APpend it to the bottom. Is there a way to do this?
What might help is that I have created my own shortcode for doing this, as it allows me to pass various parameters to the built-in search form shortcode (from the Relevanssi plugin). Here is what that shortcode looks like.
function display_group_forum(){ echo do_shortcode("[searchform post_types='topic']"); //$page_slug = bbp_get_group_forum_ids(); //echo do_shortcode("[bbp-single-forum id='$page_slug[0]']"); } add_shortcode('groupforum', 'display_group_forum');
This code shows it how I want – with search form above the discussion topics, but it is only useful in its own tab as as BuddyBoss simply duplicates the forum at the top of the view.
Perhaps there is something other than echo, or another action or hook that would allow for prepending the contents of the [groupforum] shortcode within the group tab? I can
Still, something more formal – like the two suggestions from the original post – would be wonderful additions to this fantastic plugin!
Hi Nick,
I am sorry. The plugin can not be used to modify the content of existing tabs. You can edit the visibility/availability of the tab but modifying existing content is not feasible due to nature of the tab content.If you check Existing tab option, the plugin should have disabled any option to add extra content/sub tab for the groups.
Regards
BrajeshI’ve discovered that I can use this hook “bbp_template_before_topics_loop” within my snippet to add the search form (or anything else) before the Forum tab’s topics loop.
So, now I am just overriding the label from Discussions to Forum, and don’t need to use the content section of the Group Tabs Subnav to add a shortcode.
function group_forum_search(){ code for search form } add_action( "bbp_template_before_topics_loop", "group_forum_search" );
Hi Nick,
Yes, you can do that. In fact, each of the existing pages have different template hooks available.Regards
Brajesh
The topic ‘ [Resolved] How to add or replace content within a predefined group tab?’ is closed to new replies.