Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
function on_forum_post_status_transition( $new_status, $old_status, $post ) {
// If we are not looking at a reply or a topic, bail!
if ( ! bbp_is_topic( $post ) && ! bbp_is_reply( $post ) ) {
return;
}
$forum_id = bbp_get_forum_id( $post );
$author_id = bbp_is_topic( $post )
? bbp_get_topic_author_id( $post )
: bbp_get_reply_author_id( $post );
# You now have the (topic or reply) author ID
# and the forum ID and can do further work
}
add_action( 'transition_post_status', 'on_forum_post_status_transition', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.