Skip Navigation

[Resolved] Create a discussion forum using Toolset

This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#919646

A client would like a very specific kind of user forum/knowledge base and I was wondering if I can achieve this with Toolset? Specifically I need to create responses to posts - using CRED forms that create child posts. How would that work, and how would one access the threads of posts in the back end? Would one need to create a separate 'responses' post type that has a one-many relationship with initial discussions?

We have four separate forums that are needed, each one with response threads. Site will be built using Layouts.

thanks, Ian

#919806
post_parent.JPG

Dear lan,

It is possible to create a simple forum using Toolset plugins, you just need one hierarchical post type, for example:
1) Create a custom custom hierarchical post type "forum-posts":
https://toolset.com/documentation/user-guides/create-a-custom-post-type/#even-more-advanced-custom-post-types-settings
hierarchical – lets parents be specified.

2) Create custom taxonomy "forum-name", setup the term value as the forum's name

3) Create a Toolset form for creating the new "forum-posts" post, and display the parent selector field, see screenshot post_parent.JPG
Your user can create new top level "forum-posts" post(Thread), and their child "forum-posts" posts(responses)

4) Create a view filter to display the top level "forum-posts" post:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-parent/#no-parent-return-top-level-elements
The post_parent field is zero, meaning the post has no parent.
and filter by the taxonomy "forum-name"
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

And display a child view, which filter by:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-parent/#parent-is-the-current-post-in-the-loop
The post_parent field matches the id of the current post in the loop, used with nested Views when listing a series of posts to display content from their immediate descendants.

#921075
Screen Shot 2018-07-05 at 07.44.56.png
Screen Shot 2018-07-05 at 07.44.09.png

Thanks Luo

Apologies for the slow reply - been travelling for work. Your outline is more or less what I thought, but when I create the hierarchical post type and then add the post form, there is no option to add a parent field - please see attached.

Assuming we can get this working, can one hide this field and have two different forms - one for a new thread and one for a response? If there are hundreds or thousands of posts it's not going to make sense for the user to have to select the post they are responding to.

regards

#921160

Thanks for the feedback,

Yes, you are right, the parent selector field does not work in the custom post type, it works only in the wordpress built-in post type "Page", I don't think it is good idea to use "Page" to setup the forum.

So we need to back to your original question:
it needs two custom post types:
1) post type "Threads" with custom taxonomy "Forum-name"
2) Post type "Responses"

And setup one-to-many relationship between post types "Threads" and "Responses"

You can create two different Toolset forms:
1) Form for creating "Threads" post, user can use it to submit the new "Threads" post
2) Form for creating "Responses" post, display it in the single "Threads" post,

And in the single "Threads" post, display a post view, list all related "Responses" posts

More help:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

#922784

Hi Luo - I have made a lot of progress with this - the site is here: hidden link

I got around the issues by creating hierarchical post types and then adding page attributes, which allowed children. There is one last capability I need for proper 'forum' functionality... in the 'home' page of one of the forums, for instance here: hidden link I need to push a post to the top of the list when someone responds, since that post is now the most current, even if it was an old post.

Is it possible to update the modified post date (or another custom date field) of a parent when a form is posted that creates a child post of that parent? This way I can sort the parent listings by that date field.

#922817

It needs custom codes, you can try with Toolset form action hook cred_save_data, for example, when user submit the form for creating child post, use cred_save_data to trigger a custom PHP function,
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

in this function get the parent post ID:
https://codex.wordpress.org/Function_Reference/wp_get_post_parent_id

And update the custom date field value:
https://codex.wordpress.org/Function_Reference/update_post_meta