* topic
* @uses wp_untrash_post() To untrash the reply
*/
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 );