Skip to:
Content

BuddyPress.org

Changeset 2450


Ignore:
Timestamp:
01/25/2010 02:48:13 PM (12 years ago)
Author:
apeatling
Message:

Fixes #1686

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages.php

    r2408 r2450  
    453453            return false;
    454454
    455         $message->recipients = $recipient_ids;
     455        /* Format this to match existing recipients */
     456        foreach( $recipient_ids as $i => $recipient_id ) {
     457            $message->recipients[$i] = new stdClass;
     458            $message->recipients[$i]->user_id = $recipient_id;
     459        }
    456460    }
    457461
     
    464468
    465469        // Send email notifications to the recipients
    466         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 ) );
     470        messages_notification_new_message( array( 'message_id' => $message->id, 'sender_id' => $message->sender_id, 'subject' => $message->subject, 'content' => $message->message, 'recipients' => $message->recipients, 'thread_id' => $message->thread_id) );
    467471
    468472        do_action( 'messages_message_sent', &$message );
  • trunk/bp-messages/bp-messages-classes.php

    r2408 r2450  
    295295            /* Add an recipient entry for all recipients */
    296296            foreach ( (array)$this->recipients as $recipient )
    297                 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $recipient, $this->thread_id ) );
     297                $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $recipient->user_id, $this->thread_id ) );
    298298
    299299            /* Add a sender recipient entry if the sender is not in the list of recipients */
  • trunk/bp-messages/bp-messages-notifications.php

    r2408 r2450  
    55    extract($args);
    66
    7     $message = new BP_Messages_Message( $item_id );
    8 
    9     $sender_name = bp_core_get_user_displayname( $message->sender_id );
     7    $sender_name = bp_core_get_user_displayname( $sender_id );
    108
    119    for ( $i = 0; $i < count($recipients); $i++ ) {
    12         if ( $message->sender_id == $recipients[$i]->user_id || 'no' == get_usermeta( $recipients[$i]->user_id, 'notification_messages_new_message' ) ) continue;
     10        if ( $sender_id == $recipients[$i]->user_id || 'no' == get_usermeta( $recipients[$i]->user_id, 'notification_messages_new_message' ) ) continue;
    1311
    1412        $ud = get_userdata( $recipients[$i]->user_id );
    15         $message_link = bp_core_get_user_domain( $recipients[$i]->user_id ) . 'messages/view/' . $message->id;
     13        $message_link = bp_core_get_user_domain( $recipients[$i]->user_id ) . 'messages/view/' . $message_id;
    1614        $settings_link = bp_core_get_user_domain( $recipients[$i]->user_id ) . 'settings/notifications';
    1715
    1816        // Set up and send the message
    1917        $to = $ud->user_email;
    20         $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), stripslashes( $sender_name ) );
     18        $email_subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), stripslashes( $sender_name ) );
    2119
    22         $content = sprintf( __(
     20        $email_content = sprintf( __(
    2321'%s sent you a new message:
    2422
     
    3028
    3129---------------------
    32 ', 'buddypress' ), $sender_name, stripslashes( wp_filter_kses( $message->subject ) ), stripslashes( wp_filter_kses( $message->message ) ), $message_link );
     30', 'buddypress' ), $sender_name, stripslashes( wp_filter_kses( $subject ) ), stripslashes( wp_filter_kses( $content ) ), $message_link );
    3331
    3432        $content .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    3533
    3634        // Send it
    37         wp_mail( $to, $subject, $content );
     35        wp_mail( $to, $email_subject, $email_content );
    3836    }
    3937}
    40 
    4138
    4239/* This is too expensive to send on normal servers uncomment action at your own risk. */
  • trunk/bp-themes/bp-default/sidebar.php

    r2448 r2450  
    99
    1010        <div id="sidebar-me">
    11             <a href="<?php echo bp_loggedin_user_domain() ?>" title="<?php _e( 'My Profile', 'buddypress' ) ?>">
     11            <a href="<?php echo bp_loggedin_user_domain() ?>">
    1212                <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ) ?>
    1313            </a>
Note: See TracChangeset for help on using the changeset viewer.