BP_Akismet:: check_activity (BP_Activity_Activity美元的活动

检查活动项目是否是垃圾邮件或火腿。

描述

另请参阅

参数

美元的活动

BP_Activity_Activity(必需)要检查的活动项。

文件:bp-activity /类/ class-bp-akismet.php

public function check_activity($activity){//默认情况下,只处理activity更新和activity注释。if (!in_array($activity->type, BP_Akismet::get_activity_types())))返回;//确保last_activity是清晰的,以避免任何混乱。$ this - > last_activity =零;//为Akismet构建数据包。$activity_data = BP_Akismet::build_akismet_data_package($activity);//与Akismet查看这是否是垃圾邮件。$activity_data = $this->send_akismet_request($activity_data, 'check', 'spam');//记录这个项。$ this - > last_activity = $活动; // Store a copy of the data that was submitted to Akismet. $this->last_activity->akismet_submission = $activity_data; // Spam. if ( 'true' == $activity_data['bp_as_result'] ) { /** * Fires after an activity item has been proven to be spam, but before officially being marked as spam. * * @since BuddyPress 1.6.0 * * @param BP_Activity_Activity $activity The activity item proven to be spam. * @param array $activity_data Array of activity data for item including * Akismet check results data. */ do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) ); // Mark as spam. bp_activity_mark_as_spam( $activity, 'by_akismet' ); if ( Akismet::allow_discard() && ! empty( $activity_data['akismet_pro_tip'] ) && 'discard' === $activity_data['akismet_pro_tip'] ) { // If this is so spammy it's not worth your time, let's just delete it. if ( $activity->type === 'activity_comment' ) { bp_activity_delete_comment( $activity->item_id, $activity->id ); } else { bp_activity_delete( array( 'id' => $activity->id ) ); } } } // Update activity meta after a spam check. add_action( 'bp_activity_after_save', array( $this, 'update_activity_akismet_meta' ), 1, 1 ); }

更新日志

更新日志
版本 描述
BuddyPress 1.6.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队