Shortcodes for Multi-boards
I'm using LifertLMS to deliver training material for multiple courses, wpForo to facilitate discussion & Ultimate Member to show/hide blocks/content/pages. I have created separate boards for each course. The structure of each board is exacly the same including the IDs of each category and forum. For example the FAQ topic has the ID = 3 in each board. Each forum maps to a single lesson topic.
On each lesson page I want to include only the forum that is relevant to that lesson based on the course being viewed. So I use the shortcode system e.g.
[wpforo item="forum" id="3"]
If the user is on a page that is part of course 1 then I want the FAQ topic from board 1 to show. If the user is on a page from course 2 then I want the FAQ topic from board 2 to show.
According to the documentation, the shortcode doesn't have an option to specify the board so the forum with ID = 3 is always from the first board.
How do I specify which board to source the requested forum from? If there is no current way to do this I'm happy to make a copy of the plugin and make temporary changes where indicated.
I tried this in functions.php:
The first part of the solution that seems to work is to progamtically change the board at the top of the wpforo theme's index page first making sure I'm on a lesson page (becasue the standalone pages work ok).
First copy the wpforo/themes/2022/index.php to my child theme at /my-child-theme/wpforo/index.php
The only way I've been able to get everything to work when using multiple boards and shortcodes is to modify function wpforo_url() in wpforo/includes/functions.php and call WPF()->change_board(2) there.
Is there an action or filter in Wordpress or wpForo that will allow the change in board to be reflected in the call to wpforo_url?
About the shortcodes part, will try to fix that.
If you are using only one language in your Forum, I would recommend to Use Categories instead of board and Use wpForo Cross Posting addon to connect your Courses(Posts/Pages) with wpForo Topics.
WpForo Cross Posting addon has auto cross posting functionary. Which cross posts.