Skip to:
Content

bbPress.org

Opened 5 years ago

Last modified 7 weeks ago

#3383 new defect (bug)

bbPress metadata not updated when using Oasis Workflow to publish replies

Reported by: vbadham's profile vbadham Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.6.5
Component: Component - Replies Keywords:
Cc:

Description

I am using bbPress version 2.6.5 and Oasis Workflow version 5.0 to develop a workflow that allows an admin to moderate and review a reply posted to a topic as pending before being allowed to be published. Everything works except for updating the meta data for the containing topic and forum once the reply is approved and published. In order to correct the topic and forum metadata I have added the following to a self-developed plugin that enables the bbPress rest-api and adds some additional fields to the returned rest-api JSON data. While this fixes it for me, I think that one or the other plugin should handle this problem so that others don't have the same problem and need to debug these issues.

/**
 * Fires once a post has been saved.
 *
 * @param int     $post_ID Post ID.
 * @param WP_Post $post    Post object.
 * @param bool    $update  Whether this is an existing post being updated or not.
 */
function bbpress_update_post_meta($post_ID, $post, $updated = true) {
  if ($updated) {
    if ($post && ($post->post_type == bbp_get_reply_post_type())) {
      bbp_update_reply($post_ID);
      bbp_update_topic_reply_count($post_ID);
      bbp_update_forum_reply_count(bbp_get_reply_forum_id($post_ID));
    }
  }
}
add_action( 'wp_insert_post', 'bbpress_update_post_meta', 10, 3 );

I am submitting this ticket to both bbPress and Oasis Workflow as I am not certain where the responsibility for this code should reside and I am not sure if I have captured all that needs to be done. Please let me know if you require more information.

Thank you for your help with this.

Vern Badham

Change History (0)

Note: See TracTickets for help on using tickets.