BP_Akismet::check_member_activity_update( string $content, int $user_id, int $activity_id )

Clean up the bp_latest_update usermeta in case of spamming.


Description Description

Run just after an update is posted, this method check to see whether the newly created update has been marked as spam by Akismet. If so, the cached update is cleared from the user’s ‘bp_latest_update’ usermeta, ensuring that it won’t appear in the member header and elsewhere in the theme.

This can’t be done in BP_Akismet::check_activity() due to the default AJAX implementation; see bp_dtheme_post_update().

See also See also


Top ↑

Parameters Parameters

$content

(Required) Activity update text.

$user_id

(Required) User ID.

$activity_id

(Required) Activity ID.


Top ↑

Source Source

File: bp-activity/classes/class-bp-akismet.php

	public function check_member_activity_update( $content, $user_id, $activity_id ) {
		// By default, only handle activity updates and activity comments.
		if ( empty( $this->last_activity ) || !in_array( $this->last_activity->type, BP_Akismet::get_activity_types() ) )
			return;

		// Was this $activity_id just marked as spam? If not, bail out.
		if ( !$this->last_activity->id || $activity_id != $this->last_activity->id || 'false' == $this->last_activity->akismet_submission['bp_as_result'] )
			return;

		// It was, so delete the member's latest activity update.
		bp_delete_user_meta( $user_id, 'bp_latest_update' );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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