BBP_Akismet::filter_post_terms( string $terms = '', int $topic_id, int $reply_id )

Handle any terms submitted with a post flagged as spam

Description

Parameters

$terms

(Optional) Comma-separated list of terms

Default value: ''

$topic_id

(Required)

$reply_id

(Required)

Return

(array) Array of existing topic terms

Source

File: bp-forums/extend/akismet.php

	public function filter_post_terms( $terms = '', $topic_id = 0, $reply_id = 0 ) {

		// Validate the reply_id and topic_id
		$reply_id = bbp_get_reply_id( $reply_id );
		$topic_id = bbp_get_topic_id( $topic_id );

		// Get any pre-existing terms
		$existing_terms = wp_get_object_terms( $topic_id, bbp_get_topic_tag_tax_id(), array( 'fields' => 'names' ) );

		// Save the terms for later in case the reply gets hammed
		if ( !empty( $terms ) )
			update_post_meta( $reply_id, '_bbp_akismet_spam_terms', $terms );

		// Keep the topic tags the same for now
		return $existing_terms;
	}

Changelog

Changelog
Version Description
bbPress (r3308) Introduced.

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.