Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2014 01:15:18 AM (11 years ago)
Author:
r-a-y
Message:

bp-legacy: When bulk-deleting message threads, use messages_delete_thread().

Previously, a foreach loop and a call to BP_Messages_Thread::delete()
was used to bulk-delete message threads from the inbox with AJAX.

This commit:

  • Gets rid of the foreach loop and replaces the direct BP_Messages_Thread::delete() call with BP's messages_delete_thread() function.
  • Properly sanitizes the posted 'thread_ids' with wp_parse_id_list().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-templates/bp-legacy/buddypress-functions.php

    r8048 r8052  
    13301330
    13311331    } else {
    1332         $thread_ids = explode( ',', $_POST['thread_ids'] );
    1333 
    1334         for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
    1335             BP_Messages_Thread::delete( (int) $thread_ids[$i] );
    1336         }
     1332        $thread_ids = wp_parse_id_list( $_POST['thread_ids'] );
     1333        messages_delete_thread( $thread_ids );
    13371334
    13381335        _e( 'Messages deleted.', 'buddypress' );
Note: See TracChangeset for help on using the changeset viewer.