bp_activity_spam_all_user_data (intuser_id美元

将所有用户的活动标记为垃圾邮件。

描述

参数

user_id美元

int(必需)被垃圾邮件发送的用户的ID。

返回

(保龄球)

文件:bp-activity / bp-activity-functions.php

函数bp_activity_spam_all_user_data($user_id = 0) {global $wpdb;//不要删除用户数据,除非用户已登录。If(空($user_id) || !Is_user_logged_in()){返回false;} //获取所有用户的活动。$activities = bp_activity_get(array('display_comments' => 'stream', 'filter' => array('user_id' => $user_id), 'show_hidden' => true)); / /显示当前页面英国石油美元= buddypress ();//标记为垃圾邮件。foreach ((array) $activities['activities'] as $activity){//创建活动对象。$activity_obj = new BP_Activity_Activity; foreach ( $activity as $k => $v ) { $activity_obj->$k = $v; } // Mark as spam. bp_activity_mark_as_spam( $activity_obj ); /* * If Akismet is present, update the activity history meta. * * This is usually taken care of when BP_Activity_Activity::save() happens, but * as we're going to be updating all the activity statuses directly, for efficiency, * we need to update manually. */ if ( ! empty( $bp->activity->akismet ) ) { $bp->activity->akismet->update_activity_spam_meta( $activity_obj ); } // Tidy up. unset( $activity_obj ); } // Mark all of this user's activities as spam. $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET is_spam = 1 WHERE user_id = %d", $user_id ) ); /** * Fires after all activity data from a user has been marked as spam. * * @since BuddyPress 1.6.0 * * @param int $user_id ID of the user whose activity is being marked as spam. * @param array $activities Array of activity items being marked as spam. */ do_action( 'bp_activity_spam_all_user_data', $user_id, $activities['activities'] ); }

更新日志

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

问题吗?

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