Forum Replies Created
-
Hi @casiepa,
I have failed in my attempt to set post_parent to _bbp_forum_id. Could you help me build on the code provided by @cjerrells perhaps? Though he was focused on replies, we were both experiencing the same issue on the front-end.
Or, alternatively, I am only using ONE forum. Is there any code I could use to force ALL topics created to be sent to a specified forum?
Hi @casiepa,
Thank you for jumping in!
Some additional details about my situation:
Upon submission of a specified Gravity Form, I am attempting to create a new topic under a specified forum (Forum ID: 31086).
While creating the new Topic was simple enough with the Custom Post add-on—which successfully created the Topic, including the body of the topic post, accordingly—the topic was being listed under “No Forum.” @cjerrells post got me closer, encouraging me to add another custom field named _bbp_forum_id with a default value of 31086 (the forum ID). After doing that, the assigned forum seemed to display correctly on the backend, but:
1) The breadcrumb would only display the forum after editing and resaving the post again
— It still will not, however, show on the front-end forum among the other forum topics
2) The topic would finally display correctly on the front-end among the other forum topics only after adding a reply to the topic post.
Here is a screenshot of my Gravity Form settings, as well as the code cjerrells kindly provided within my functions.php file. My ability to write php is still very elementary, and it seems a bit difficult to find a full list of bbPress actions and hooks, so I wasn’t sure exactly what needed to be altered to fit my needs.
I would be beyond appreciative if you could give it all a look and get back to me with any thoughts or ideas you may have.
cjerrels,
I have essentially wound up at the same point as you, except saving on the backend isn’t what put (in my case) the topic in the correct forum, but adding a reply to the topic did.
What is the hook you used to “monitor for new posts and if a particular custom field is set, then sets the “post_parent” property correctly?”
Thanks, Robin. Just reached out.
Ah, sorry! I missed that reply!
But unfortunately that code broke the site (all good now that I removed the code, of course, so no worries whatsoever).
I completely understand and I am beyond appreciative for the time you have already taken.
If you get the chance to take another look, fantastic. If not, and you or anyone else can point me in the right direction or take another stab at it, that would be great too.
Thank you for everything, Robin.
Still no luck, I’m sorry to say.
Robin,
You are a saint and I can’t even begin to express how much I appreciate you taking the time to help me out with this. Really.
I assure you I am “proficient enough” to use an FTP client for any potential changes; I’m just very elementary in terms of writing the code myself.
I added the code to my functions.php, but, as you suspected, it did not yield the desired result.
I’m also totally open to ditching that plugin solution entirely, unless there is some other way you know of that I could restructure my forum in such a way that it becomes accordingly hierarchical. Or perhaps some implementation revolved around categories or topic tags? I’m open to anything that will get these submissions routed into a specified forum.
Again, thank you so much, and please let me know if there’s anything I can provide you with that might fill in any potential blanks.
To that end, maybe the Gravity Forms submission hooks might help? The documentation can be found here.
Understood, but maybe this, below, is a straightforward solution?
Is there a function that could force all new topics to be created under a specified forum ID (in this case, that would be 31086)?
To your point about the plugin, it also states:
Try to set parent
If this is checked, and the form creates a post type, then the parent for the newly created post type will be set from the value of this field. Please note that this only works for heirarcical post typs e.g. pages
This would not be a hierarchical post type, because Forums and Topics are totally separate custom post types, correct?
Awesome, I appreciate the quick response tremendously, Robin!
Since the Gravity Forms submission will — each time — be creating the forum topic (post) itself, however, how could I include the topic (post) ID? Would that be the form ID in this case?