bp_nouveau_ajax_spam_activity ()
AJAX发送活动项或评论。
描述
返回
(字符串)JSON应答。
源
文件:bp-templates / bp-nouveau包括/活动/ ajax.php
函数bp_nouveau_ajax_spam_activity() {$bp = buddypress();$response = array('feedback' => sprintf('', esc_html__('将此活动标记为垃圾邮件有问题。请再试一次。', 'buddyboss')),);//如果不是POST操作,则保释。如果(!Bp_is_post_request ()) {wp_send_json_error($response);} if (!is_user_logged_in () | | !Bp_is_active ('activity') || empty($bp->activity->akismet)) {wp_send_json_error($response); } if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) ) { wp_send_json_error( $response ); } // Is the current user allowed to spam items? if ( ! bp_activity_user_can_mark_spam() ) { wp_send_json_error( $response ); } $activity = new BP_Activity_Activity( (int) $_POST['id'] ); if ( empty( $activity->component ) ) { wp_send_json_error( $response ); } // Nonce check! if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'bp_activity_akismet_spam_' . $activity->id ) ) { wp_send_json_error( $response ); } /** This action is documented in bp-activity/bp-activity-actions.php */ do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity ); // Mark as spam. bp_activity_mark_as_spam( $activity ); $activity->save(); /** This action is documented in bp-activity/bp-activity-actions.php */ do_action( 'bp_activity_action_spam_activity', $activity->id, $activity->user_id ); // Prepare the successfull reply $response = array( 'spammed' => $activity->id ); // If on a single activity redirect to user's home. if ( ! empty( $_POST['is_single'] ) ) { $response['redirect'] = bp_core_get_user_domain( $activity->user_id ); bp_core_add_message( __( 'This activity has been marked as spam and is no longer visible.', 'buddyboss' ) ); } // Send the json reply wp_send_json_success( $response ); }
更新日志
版本 | 描述 |
---|---|
BuddyPress 3.0.0 | 介绍了。 |