Changeset 9184
- Timestamp:
- 11/26/2014 06:08:39 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-classes.php
r9183 r9184 255 255 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) ); 256 256 257 // Get the message id in order to pass to the action258 $message_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );257 // Get the message ids in order to pass to the action 258 $message_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) ); 259 259 260 260 // Check to see if any more recipients remain for this message … … 266 266 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) ); 267 267 268 // Do something for each message ID 269 foreach ( $message_ids as $message_id ) { 270 // Delete message meta 271 bp_messages_delete_meta( $message_id ); 272 273 /** 274 * Fires after a message is deleted. This hook is poorly named. 275 * 276 * @since BuddyPress (1.0.0) 277 * 278 * @param int $message_id ID of the message 279 */ 280 do_action( 'messages_thread_deleted_thread', $message_id ); 281 } 282 268 283 // Delete all the recipients 269 284 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) ); … … 271 286 272 287 /** 273 * Fires after a message thread is deleted.288 * Fires after a message thread is either marked as deleted or deleted 274 289 * 275 290 * @since BuddyPress (2.2.0) 276 291 * 277 * @param int $thread_id ID of the thread being deleted. 292 * @param int $thread_id ID of the thread being deleted. 293 * @param array $message_ids IDs of messages being deleted. 278 294 */ 279 do_action( 'bp_messages_thread_after_delete', $ message_id);295 do_action( 'bp_messages_thread_after_delete', $thread_id, $message_ids ); 280 296 281 297 return true;
Note: See TracChangeset
for help on using the changeset viewer.