bbp_unapprove_topic( int $topic_id )

Unapproves a topic


Description Description


Parameters Parameters

$topic_id

(Required) Topic id


Top ↑

Return Return

(mixed) False or WP_Error on failure, topic id on success


Top ↑

Source Source

File: includes/topics/functions.php

function bbp_unapprove_topic( $topic_id = 0 ) {

	// Get topic
	$topic = bbp_get_topic( $topic_id );
	if ( empty( $topic ) ) {
		return $topic;
	}

	// Get new status
	$status = bbp_get_pending_status_id();

	// Bail if already unapproved
	if ( ! bbp_is_topic_public( $topic_id ) ) {
		return false;
	}

	// Execute pre open code
	do_action( 'bbp_unapprove_topic', $topic_id );

	// Set pending 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 open code
	do_action( 'bbp_unapproved_topic', $topic_id );

	// Return topic_id
	return $topic_id;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.