Changeset 9185 for trunk/src/bp-messages/bp-messages-classes.php
- Timestamp:
- 11/26/2014 06:08:54 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-classes.php
r9184 r9185 233 233 234 234 /** 235 * Delete a message thread. 235 * Mark messages in a thread as deleted or delete all messages in a thread. 236 * 237 * Note: All messages in a thread are deleted once every recipient in a thread 238 * has marked the thread as deleted. 236 239 * 237 240 * @since BuddyPress (1.0.0) … … 244 247 245 248 /** 246 * Fires before a message thread is deleted.249 * Fires before a message thread is marked as deleted. 247 250 * 248 251 * @since BuddyPress (2.2.0) … … 250 253 * @param int $thread_id ID of the thread being deleted. 251 254 */ 252 do_action( 'bp_messages_thread_before_ delete', $thread_id );255 do_action( 'bp_messages_thread_before_mark_delete', $thread_id ); 253 256 254 257 // Mark messages as deleted 258 // 259 // @todo the reliance on bp_loggedin_user_id() sucks for plugins 260 // refactor this method to accept a $user_id parameter 255 261 $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 262 … … 259 265 260 266 // Check to see if any more recipients remain for this message 261 // if not, then delete the message from the database.262 267 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0", $thread_id ) ); 263 268 269 // No more recipients so delete all messages associated with the thread 264 270 if ( empty( $recipients ) ) { 271 /** 272 * Fires before an entire message thread is deleted. 273 * 274 * @since BuddyPress (2.2.0) 275 * 276 * @param int $thread_id ID of the thread being deleted. 277 * @param array $message_ids IDs of messages being deleted. 278 */ 279 do_action( 'bp_messages_thread_before_delete', $thread_id, $message_ids ); 280 265 281 // Delete all the messages 266 282 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );
Note: See TracChangeset
for help on using the changeset viewer.