Created
January 27, 2019 15:59
-
-
Save barryhughes/30bacb98b716ecaa864f0b6eaa7c051c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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