[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-messages/actions/ -> bulk-delete.php (source)

   1  <?php
   2  /**
   3   * Messages: Bulk-delete action handler.
   4   *
   5   * @package BuddyPress
   6   * @subpackage MessageActions
   7   * @since 3.0.0
   8   */
   9  
  10  /**
  11   * Process a request to bulk delete messages.
  12   *
  13   * @return bool False on failure.
  14   */
  15  function messages_action_bulk_delete() {
  16  
  17      if ( ! bp_is_messages_component() || ! bp_is_action_variable( 'bulk-delete', 0 ) ) {
  18          return false;
  19      }
  20  
  21      $thread_ids = $_POST['thread_ids'];
  22  
  23      if ( ! $thread_ids || ! messages_check_thread_access( $thread_ids ) ) {
  24          bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
  25      } else {
  26          if ( ! check_admin_referer( 'messages_delete_thread' ) ) {
  27              return false;
  28          }
  29  
  30          if ( ! messages_delete_thread( $thread_ids ) ) {
  31              bp_core_add_message( __( 'There was an error deleting messages.', 'buddypress' ), 'error' );
  32          } else {
  33              bp_core_add_message( __( 'Messages deleted.', 'buddypress' ) );
  34          }
  35  
  36          bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
  37      }
  38  }
  39  add_action( 'bp_actions', 'messages_action_bulk_delete' );


Generated: Sun Dec 22 01:00:54 2024 Cross-referenced by PHPXref 0.7.1