コード例 #1
0
/**
 * Mark the posted activity as spam, if it contains blacklist keywords.
 *
 * @since 1.6.0
 *
 * @param BP_Activity_Activity $activity The activity object to check.
 */
function bp_activity_check_blacklist_keys($activity)
{
    // Only check specific types of activity updates.
    if (!in_array($activity->type, bp_activity_get_moderated_activity_types())) {
        return;
    }
    // Send back the error so activity update fails.
    // @todo This is temporary until some kind of trash status is built.
    $blacklist = bp_core_check_for_blacklist($activity->user_id, '', $activity->content, 'wp_error');
    if (is_wp_error($blacklist)) {
        $activity->errors = $blacklist;
        // Backpat.
        $activity->component = false;
    }
}
コード例 #2
0
/**
 * Mark the posted activity as spam, if it contains blacklist keywords.
 *
 * @since 1.6.0
 *
 * @param BP_Activity_Activity $activity The activity object to check.
 */
function bp_activity_check_blacklist_keys($activity)
{
    // Only check specific types of activity updates.
    if (!in_array($activity->type, bp_activity_get_moderated_activity_types())) {
        return;
    }
    // Mark as spam.
    if (!bp_core_check_for_blacklist($activity->user_id, '', $activity->content)) {
        bp_activity_mark_as_spam($activity, 'by_blacklist');
    }
}
コード例 #3
0
/**
 * Check activity stream for blacklisted keys
 *
 * @since BuddyPress (1.6)
 * @param BP_Activity_Activity $activity
 * @return If activity type is not an update or comment
 */
function bp_activity_check_blacklist_keys($activity)
{
    // Only check specific types of activity updates
    if (!in_array($activity->type, bp_activity_get_moderated_activity_types())) {
        return;
    }
    // Unset the activity component so activity stream update fails
    if (!bp_core_check_for_blacklist($activity->user_id, '', $activity->content)) {
        $activity->component = false;
    }
}