Changeset 11153 for trunk/src/bp-messages/bp-messages-functions.php
- Timestamp:
- 09/22/2016 01:28:23 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-functions.php
r11022 r11153 237 237 238 238 /** 239 * Delete message thread(s). 239 * Deletes message thread(s) for a given user. 240 * 241 * Note that "deleting" a thread for a user means removing it from the user's 242 * message boxes. A thread is not deleted from the database until it's been 243 * "deleted" by all recipients. 244 * 245 * @since 2.7.0 The $user_id parameter was added. Previously the current user 246 * was always assumed. 240 247 * 241 248 * @param int|array $thread_ids Thread ID or array of thread IDs. 249 * @param int $user_id ID of the user to delete the threads for. Defaults 250 * to the current logged-in user. 242 251 * @return bool True on success, false on failure. 243 252 */ 244 function messages_delete_thread( $thread_ids ) { 253 function messages_delete_thread( $thread_ids, $user_id = 0 ) { 254 255 if ( empty( $user_id ) ) { 256 $user_id = bp_loggedin_user_id(); 257 } 245 258 246 259 /** … … 248 261 * 249 262 * @since 1.5.0 263 * @since 2.7.0 The $user_id parameter was added. 250 264 * 251 * @param int|array Thread ID or array of thread IDs that were deleted. 265 * @param int|array $thread_ids Thread ID or array of thread IDs to be deleted. 266 * @param int $user_id ID of the user the threads are being deleted for. 252 267 */ 253 do_action( 'messages_before_delete_thread', $thread_ids );268 do_action( 'messages_before_delete_thread', $thread_ids, $user_id ); 254 269 255 270 if ( is_array( $thread_ids ) ) { 256 271 $error = 0; 257 272 for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) { 258 if ( ! BP_Messages_Thread::delete( $thread_ids[$i] ) ) {273 if ( ! BP_Messages_Thread::delete( $thread_ids[$i], $user_id ) ) { 259 274 $error = 1; 260 275 } … … 269 284 * 270 285 * @since 1.0.0 286 * @since 2.7.0 The $user_id parameter was added. 271 287 * 272 288 * @param int|array Thread ID or array of thread IDs that were deleted. 289 * @param int ID of the user that the threads were deleted for. 273 290 */ 274 do_action( 'messages_delete_thread', $thread_ids );291 do_action( 'messages_delete_thread', $thread_ids, $user_id ); 275 292 276 293 return true; 277 294 } else { 278 if ( ! BP_Messages_Thread::delete( $thread_ids ) ) {295 if ( ! BP_Messages_Thread::delete( $thread_ids, $user_id ) ) { 279 296 return false; 280 297 } 281 298 282 299 /** This action is documented in bp-messages/bp-messages-functions.php */ 283 do_action( 'messages_delete_thread', $thread_ids );300 do_action( 'messages_delete_thread', $thread_ids, $user_id ); 284 301 285 302 return true;
Note: See TracChangeset
for help on using the changeset viewer.