Loads Akismet extension

since 2.0.0 bbPress (r3277)
package bbPress
subpackage Akismet

 Methods

The main bbPress Akismet loader

__construct() 
since 2.0.0 bbPress (r3277)

Add Aksimet History meta-boxes to topics and replies

add_metaboxes() 
since 2.4.0 bbPress (r5049)

Converts topic/reply data into Akismet comment checking format

check_post(array $post_data = array()) : array
since 2.0.0 bbPress (r3277)

Parameters

$post_data

array

Returns

arrayArray of post data

Deletes old spam topics & replies from the queue after 15 days (determined by `_bbp_akismet_delete_spam_interval` filter) since they are not useful in the long term.

delete_old_spam() 
since 2.6.7 bbPress (r7203)
global wpdb $wpdb

Deletes `_bbp_akismet_as_submitted` meta keys after 15 days (determined by `_bbp_akismet_delete_spam_meta_interval` filter) since they are large and not useful in the long term.

delete_old_spam_meta() 
since 2.6.7 bbPress (r7203)
global wpdb $wpdb

Clears post meta that no longer has corresponding posts in the database (determined by `_bbp_akismet_delete_spam_orphaned_limit` filter) since it is not useful in the long term.

delete_orphaned_spam_meta() 
since 2.6.7 bbPress (r7203)
global wpdb $wpdb

Handle any terms submitted with a post flagged as spam

filter_post_terms(string $terms = '', integer $topic_id = 0, integer $reply_id = 0) : array
since 2.0.0 bbPress (r3308)

Parameters

$terms

string

Comma-separated list of terms

$topic_id

integer

$reply_id

integer

Returns

arrayArray of existing topic terms

Get the interval (in days) for spam to remain in the queue.

get_delete_interval(string $filter = '') : integer
since 2.6.9 bbPress (r7225)

Parameters

$filter

string

The name of the filter to run.

Returns

integer

Get the number of rows to delete in a single clean-up query.

get_delete_limit(string $filter = '') : integer
since 2.6.9 bbPress (r7225)

Parameters

$filter

string

The name of the filter to run.

Returns

integer

Get the Akismet history of a Post

get_post_history(integer $post_id = 0) : array
since 2.0.0 bbPress (r3308)

Parameters

$post_id

integer

Returns

arrayArray of Akismet history

Output for Akismet History meta-box

history_metabox() 
since 2.4.0 bbPress (r5049)

Submit a post for spamming or hamming

submit_post(integer $post_id = 0) : array
since 2.0.0 bbPress (r3277)
global string $akismet_api_host
global string $akismet_api_port
global object $current_user
global object $current_site

Parameters

$post_id

integer

Returns

arrayArray of existing topic terms

Handles the repeated calls to wp_remote_post(), including SSL support.

get_response(string $host_and_path = '', array $http_args = array()) : array
since 2.6.7 (bbPress r7194)

Parameters

$host_and_path

string

Scheme-less URL

$http_args

array

Array of arguments for wp_remote_post()

Returns

array

Return a user's roles on this site (including super_admin)

get_user_roles(integer $user_id = 0) : boolean
since 2.3.0 bbPress (r4812)

Parameters

$user_id

integer

Returns

boolean

Submit data to Akismet service with unique bbPress User Agent

http_post(string $request, string $host, string $path, string $port = 80, string $ip = '') : mixed

This code is directly taken from the akismet_http_post() function and documented to bbPress 2.0 standard.

since 2.0.0 bbPress (r3466)

Parameters

$request

string

The request we are sending

$host

string

The host to send our request to

$path

string

The path from the host

$port

string

The port to use

$ip

string

Optional Override $host with an IP address

Returns

mixedWP_Error on error, array on success, empty on failure

Ping Akismet service and check for spam/ham response

maybe_spam(array $post_data = array(), string $check = 'check', string $spam = 'spam') : array
since 2.0.0 bbPress (r3277)
global string $akismet_api_host
global string $akismet_api_port

Parameters

$post_data

array

$check

string

Accepts check|submit

$spam

string

Accepts spam|ham

Returns

arrayArray of post data

Parse the response from the Akismet service, and alter the post data as necessary. For example, switch the status to `spam` if spammy.

parse_response(array $post_data = array()) : array

Note: this method also is 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.

since 2.6.0 bbPress (r6873)

Parameters

$post_data

array

Returns

array

Setup the admin hooks

setup_actions() 
since 2.0.0 bbPress (r3277)
access private

Update Akismet history of a Post

update_post_history(integer $post_id = 0, string $message = null, string $event = null
since 2.0.0 bbPress (r3308)

Parameters

$post_id

integer

$message

string

$event

string