bbp_untrash_topic( $topic_id )
Called before untrashing a topic
Description
Source
File: bp-forums/topics/functions.php
3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 | function bbp_untrash_topic( $topic_id = 0 ) { $topic_id = bbp_get_topic_id( $topic_id ); if ( empty ( $topic_id ) || !bbp_is_topic( $topic_id ) ) return false; do_action( 'bbp_untrash_topic' , $topic_id ); // Get the replies that were not previously trashed $pre_trashed_replies = get_post_meta( $topic_id , '_bbp_pre_trashed_replies' , true ); // There are replies to untrash if ( ! empty ( $pre_trashed_replies ) ) { // Maybe reverse the trashed replies array if ( is_array ( $pre_trashed_replies ) ) $pre_trashed_replies = array_reverse ( $pre_trashed_replies ); // Loop through replies foreach ( ( array ) $pre_trashed_replies as $reply ) { wp_untrash_post( $reply ); } } } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.