BBP_Replies_Admin::handle_bulk_actions( string $sendback, string $doaction, array $post_ids )
Handle spam/unspam bulk actions.
Description Description
Parameters Parameters
- $sendback
-
(Required) The sendback URL.
- $doaction
-
(Required) The action to be taken.
- $post_ids
-
(Required) The post IDS to take the action on.
Return Return
(string) The sendback URL.
Source Source
File: includes/admin/replies.php
public function handle_bulk_actions( $sendback, $doaction, $post_ids ) { $sendback = remove_query_arg( array( 'spam', 'unspam' ), $sendback ); $updated = $locked = 0; if ( 'spam' === $doaction ) { foreach ( (array) $post_ids as $post_id ) { if ( ! current_user_can( 'moderate', $post_id ) ) { wp_die( esc_html__( 'Sorry, you are not allowed to spam this item.', 'bbpress' ) ); } if ( wp_check_post_lock( $post_id ) ) { $locked++; continue; } if ( ! bbp_spam_reply( $post_id ) ) { wp_die( esc_html__( 'Error in spamming reply.', 'bbpress' ) ); } $updated++; } $sendback = add_query_arg( array( 'updated' => $updated, 'ids' => implode( ',', $post_ids ), 'locked' => $locked ), $sendback ); } elseif ( 'unspam' === $doaction ) { foreach ( (array) $post_ids as $post_id ) { if ( ! current_user_can( 'moderate', $post_id ) ) { wp_die( esc_html__( 'Sorry, you are not allowed to unspam this reply.', 'bbpress' ) ); } if ( wp_check_post_lock( $post_id ) ) { $locked++; continue; } if ( ! bbp_unspam_reply( $post_id ) ) { wp_die( esc_html__( 'Error in unspamming reply.', 'bbpress' ) ); } $updated++; } $sendback = add_query_arg( array( 'updated' => $updated, 'ids' => implode( ',', $post_ids ), 'locked' => $locked ), $sendback ); } return $sendback; }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |