bbp_approve_topic( int $topic_id )
Approves a pending topic
Description Description
Parameters Parameters
- $topic_id
-
(Required) Topic id
Return Return
(mixed) False or WP_Error on failure, topic id on success
Source Source
File: includes/topics/functions.php
function bbp_approve_topic( $topic_id = 0 ) { // Get topic $topic = bbp_get_topic( $topic_id ); if ( empty( $topic ) ) { return $topic; } // Get new status $status = bbp_get_public_status_id(); // Bail if already approved if ( $status === $topic->post_status ) { return false; } // Execute pre pending code do_action( 'bbp_approve_topic', $topic_id ); // Set publish status $topic->post_status = $status; // No revisions remove_action( 'pre_post_update', 'wp_save_post_revision' ); // Update topic $topic_id = wp_update_post( $topic ); // Execute post pending code do_action( 'bbp_approved_topic', $topic_id ); // Return topic_id return $topic_id; }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |