bp_activity_mark_as_ham( BP_Activity_Activity $activity, string $source = 'by_a_person' )
Mark an activity item as ham.
Description
Parameters
- $activity
-
(Required) The activity item to be hammed. Passed by reference.
- $source
-
(Optional) Default is "by_a_person" (ie, a person has manually marked the activity as spam). BP core also accepts 'by_akismet'.
Default value: 'by_a_person'
Source
File: bp-activity/bp-activity-functions.php
3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 | function bp_activity_mark_as_ham( & $activity , $source = 'by_a_person' ) { $bp = buddypress(); $activity ->is_spam = 0; // Clear the activity feed first page cache. wp_cache_delete( 'bp_activity_sitewide_front' , 'bp' ); // Clear the activity comment cache for this activity item. wp_cache_delete( $activity ->id, 'bp_activity_comments' ); // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity. if ( 'by_a_person' == $source && ! empty ( $bp ->activity->akismet ) ) { remove_action( 'bp_activity_before_save' , array ( $bp ->activity->akismet, 'check_activity' ), 4 ); // Build data package for Akismet. $activity_data = BP_Akismet::build_akismet_data_package( $activity ); // Tell Akismet this is spam. $activity_data = $bp ->activity->akismet->send_akismet_request( $activity_data , 'submit' , 'ham' ); // Update meta. add_action( 'bp_activity_after_save' , array ( $bp ->activity->akismet, 'update_activity_ham_meta' ), 1, 1 ); } /** * Fires at the end of the process to mark an activity item as ham. * * @since BuddyPress 1.6.0 * * @param BP_Activity_Activity $activity Activity item being marked as ham. * @param string $source Source of determination of ham status. For example * "by_a_person" or "by_akismet". */ do_action( 'bp_activity_mark_as_ham' , $activity , $source ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.6.0 | 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.