Changeset 462
- Timestamp:
- 10/30/2008 12:18:36 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
bp-friends.php (modified) (1 diff)
-
bp-messages.php (modified) (4 diffs)
-
bp-messages/bp-messages-classes.php (modified) (5 diffs)
-
bp-messages/bp-messages-notifications.php (added)
-
bp-xprofile.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends.php
r449 r462 118 118 function friends_screen_requests() { 119 119 global $bp; 120 121 // Remove any notifications of new friend requests as we are viewing the 122 // friend request page 123 bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'friends', 'friendship_request' ); 124 120 125 121 if ( isset($bp['action_variables']) && in_array( 'accept', $bp['action_variables'] ) && is_numeric($bp['action_variables'][1]) ) { 126 122 127 123 if ( friends_accept_friendship( $bp['action_variables'][1] ) ) { 124 //bp_core_delete_notification( $bp['loggedin_userid'], 'friends', 'friendship_request' ); 125 128 126 $bp['message'] = __('Friendship accepted', 'buddypress'); 129 127 $bp['message_type'] = 'success'; -
trunk/bp-messages.php
r449 r462 10 10 include_once( 'bp-messages/bp-messages-admin.php' ); 11 11 include_once( 'bp-messages/bp-messages-templatetags.php' ); 12 include_once( 'bp-messages/bp-messages-notifications.php' ); 12 13 13 14 /************************************************************************** … … 346 347 } 347 348 348 349 /**************************************************************************350 messages_format_activity()351 352 Selects and formats recorded messages component activity.353 **************************************************************************/354 355 function messages_format_activity( $friendship_id, $action, $for_secondary_user = false ) {356 global $bp;357 358 switch( $action ) {359 // no actions set yet.360 }361 362 return false;363 }364 365 349 function messages_format_notifications( $action, $item_id, $total_items ) { 366 350 global $bp; … … 512 496 // Send notices to the recipients 513 497 for ( $i = 0; $i < count($pmessage->recipients); $i++ ) { 514 if ( $pmessage->recipients[$i] != $bp['loggedin_userid'] ) 498 if ( $pmessage->recipients[$i] != $bp['loggedin_userid'] ) { 515 499 bp_core_add_notification( $pmessage->id, $pmessage->recipients[$i], 'messages', 'new_message' ); 500 } 516 501 } 517 502 518 do_action( 'bp_messages_message_sent', array( 'item_id' => $pmessage->id, 'recipient_ids' => $pmessage->recipients, ' component_name' => 'messages', 'component_action' => 'message_sent', 'is_private' => 1 ) );503 do_action( 'bp_messages_message_sent', array( 'item_id' => $pmessage->id, 'recipient_ids' => $pmessage->recipients, 'thread_id' => $pmessage->thread_id, 'component_name' => 'messages', 'component_action' => 'message_sent', 'is_private' => 1 ) ); 519 504 520 505 if ( $from_ajax ) { … … 582 567 $notice->is_active = 1; 583 568 $notice->save(); // send it. 569 570 do_action( 'bp_messages_notice_sent', $subject, $message ); 584 571 } 585 572 -
trunk/bp-messages/bp-messages-classes.php
r391 r462 284 284 285 285 var $thread_id; 286 var $recipients ;286 var $recipients = false; 287 287 288 288 function bp_messages_message( $id = null ) { … … 318 318 319 319 // First insert the message into the messages table 320 $sql = $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_messages'] . " ( sender_id, subject, message, date_sent, message_order, sender_is_group ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $userdata->ID, $this->subject, $this->message, $this->date_sent, $this->message_order, $this->sender_is_group ); 321 322 if ( $wpdb->query($sql) === false ) 323 return false; 324 320 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_messages'] . " ( sender_id, subject, message, date_sent, message_order, sender_is_group ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $userdata->ID, $this->subject, $this->message, $this->date_sent, $this->message_order, $this->sender_is_group ) ) ) 321 return false; 322 325 323 // Next, if thread_id is set, we are adding to an existing thread, if not, start a new one. 326 324 if ( $this->thread_id ) { … … 331 329 $message_ids = serialize($message_ids); 332 330 331 // We need this so we can return the new message ID. 332 $message_id = $wpdb->insert_id; 333 333 334 // Update the sender ids for the thread 334 335 $sender_ids = unserialize($the_ids->sender_ids); … … 345 346 346 347 // Find the recipients and update the unread counts for each 347 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d", $this->thread_id ) ); 348 349 for ( $i = 0; $i < count($recipients); $i++ ) { 350 if ( $recipients[$i]->user_id != $userdata->ID ) 351 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = unread_count + 1, sender_only = 0 WHERE thread_id = %d AND user_id = %d", $this->thread_id, $recipients[$i]->user_id ) ); 348 if ( !$this->recipients ) 349 $this->recipients = $this->get_recipients(); 350 351 for ( $i = 0; $i < count($this->recipients); $i++ ) { 352 if ( $this->recipients[$i]->user_id != $userdata->ID ) 353 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = unread_count + 1, sender_only = 0 WHERE thread_id = %d AND user_id = %d", $this->thread_id, $this->recipients[$i]->user_id ) ); 352 354 } 353 355 } else { … … 374 376 } 375 377 } 376 update_usermeta( $userdata->ID, 'last_activity', date( 'Y-m-d H:i:s' ) ); 378 379 $this->id = $message_id; 377 380 378 381 return true; 382 } 383 384 function get_recipients() { 385 global $bp, $wpdb; 386 387 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d", $this->thread_id ) ); 379 388 } 380 389 -
trunk/bp-xprofile.php
r454 r462 338 338 339 339 --------------------- 340 ', 'buddypress' ), $poster_name, $wire_post->content, $wire_link );340 ', 'buddypress' ), $poster_name, stripslashes($wire_post->content), $wire_link ); 341 341 342 342 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
Note: See TracChangeset
for help on using the changeset viewer.