Forum Replies Created
-
There were no changes to the topic entry in post or postmeta after I updated a reply.
The only thing that changes that I can see is the post_parent gets updated to the correct topic id in the posts table.
However, I have tried to change that value using phpMyAdmin, and it didn’t make the reply show up in the forum front end.
No, it is really weird. When I submit the form, it creates two database entries, a reply first and then a revision. The reply has a post_parent of 0, and the revision has a post_parent number that matches the post ID of the reply.
The post meta has the correct forum and topic.
If I go into the WP admin panel and find the reply, then hit update, the reply in the database changes, and gets the proper post_parent automatically, and the revision is unchanged.
It appears that the post_parent is no longer updating in the database for some reason. So, I am trying to fix that, and to run the bbp update programatically as well because that seems to fix it when I run it on replies in the admin panel. This is the code I am using, but it isn’t working.
This is what I have so far. Does anything look wrong to you?
add_action( 'gform_post_submission', 'set_post_content', 10, 2 ); function set_post_content( $entry, $form ) { //getting post $post = get_post( $entry['post_id'] ); //getting meta values $topicID = get_post_meta($post,'_bbp_topic_id',true); $forumID = get_post_meta($post,'_bbp_forum_id',true); $reply_data = array('post_parent'=>$topicID); $reply_meta = array('forum_id'=>$forumID, 'topic_id' => $topicID); bbp_update_reply($reply_data,$reply_meta); }
Yes, my form submission adds things to the metadata.
When I open up All Replies in the admin panel, it shows that the reply is in the proper forum and topic. If I edit the reply from there, and hit update, everything shows properly in the forum. Before I update it, it does not show up on the front end.
Yes, I can link to an action on form submission.
Thanks for your help!
I did refer to them and they said that I should find out what metadata was needed by BBPress, and make sure that was added when the form was submitted.
I researched the docs here and found that I needed to include _bbp_forum_id and _bbp_topic_id. So, the replies were being posted to the correct forum and topic, but they weren’t showing up on the front end of the forum. I read elsewhere in this forum that the post_parent had to be updated, so I did that using a code snippet.
But, the problem is that I am missing something for BBPress. Gravity Forms and the extension are working properly, but something is missing in BBPress until I update the topic from the back end.