Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
BBP_Akismet::parse_response( array $post_data = array() )
Parse the response from the Akismet service, and alter the post data as necessary. For example, switch the status to spam
if spammy.
Description Description
Note: this method also skiis responsible for allowing users who can moderate, to never have their posts marked as spam. This is because they are "trusted" users. However, their posts are still sent to Akismet to be checked.
Parameters Parameters
- $post_data
-
(Optional)
Default value: array()
Return Return
(array)
Source Source
File: includes/extend/akismet.php
private function parse_response( $post_data = array() ) { // Get the parent ID of the post as submitted $parent_id = ! empty( $post_data['bbp_post_as_submitted']['comment_post_ID'] ) ? absint( $post_data['bbp_post_as_submitted']['comment_post_ID'] ) : 0; // Allow moderators to skip spam (includes per-forum moderators via $parent_id) $skip_spam = current_user_can( 'moderate', $parent_id ); // Bail early if current user can skip spam enforcement if ( apply_filters( 'bbp_bypass_spam_enforcement', $skip_spam, $post_data ) ) { return $post_data; } // Result is spam, so set the status as such if ( 'true' === $post_data['bbp_akismet_result'] ) { // Let plugins do their thing do_action( 'bbp_akismet_spam_caught' ); // Set post_status to spam $post_data['post_status'] = bbp_get_spam_status_id(); // Filter spammy tags into meta data add_filter( 'bbp_new_reply_pre_set_terms', array( $this, 'filter_post_terms' ), 1, 3 ); } // Return the (potentially modified) post data return $post_data; }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |