Changeset 1655 for trunk/bp-messages.php
- Timestamp:
- 08/13/2009 01:24:21 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-messages.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages.php
r1651 r1655 284 284 $thread_id = $bp->action_variables[0]; 285 285 286 if ( !$thread_id || ( !messages_check_thread_access($thread_id) && !is_site_admin() ) )286 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_site_admin() ) ) 287 287 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component ); 288 288 … … 291 291 292 292 /* Check the nonce */ 293 check_admin_referer( 'messages_send_message' );293 check_admin_referer( 'messages_send_message', 'send_message_nonce' ); 294 294 295 295 /* Send the reply */ … … 310 310 global $bp, $thread_id; 311 311 312 if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'delete' )312 if ( $bp->current_component != $bp->messages->slug || 'notices' == $bp->current_action || $bp->action_variables[0] != 'delete' ) 313 313 return false; 314 314 … … 453 453 } 454 454 455 return $message->send(); 455 if ( $message->send() ) { 456 require_once( BP_PLUGIN_DIR . '/bp-messages/bp-messages-notifications.php' ); 457 458 // Send screen notifications to the recipients 459 foreach ( $message->recipients as $recipient ) { 460 bp_core_add_notification( $message->id, $recipient, 'messages', 'new_message' ); 461 } 462 463 // Send email notifications to the recipients 464 messages_notification_new_message( array( 'item_id' => $message->id, 'recipient_ids' => $message->recipients, 'thread_id' => $message->thread_id, 'component_name' => $bp->messages->slug, 'component_action' => 'message_sent', 'is_private' => 1 ) ); 465 466 do_action( 'messages_message_sent', &$message ); 467 468 return $message->thread_id; 469 } 470 471 return false; 456 472 } 457 473 … … 537 553 } 538 554 555 function messages_is_valid_thread( $thread_id ) { 556 return BP_Messages_Thread::is_valid( $thread_id ); 557 } 558 539 559 function messages_ajax_autocomplete_results() { 540 560 global $bp; … … 545 565 if ( function_exists( 'friends_search_friends' ) ) 546 566 $friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 ); 547 567 548 568 $friends = apply_filters( 'bp_friends_autocomplete_list', $friends, $_GET['q'], $_GET['limit'] ); 549 569 … … 552 572 $ud = get_userdata($user_id); 553 573 $username = $ud->user_login; 554 echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) ) . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')574 echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) ) . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ') 555 575 '; 556 576 }
Note: See TracChangeset
for help on using the changeset viewer.