Ticket #5945: bp-messages-notifications-5945.diff
| File bp-messages-notifications-5945.diff, 3.8 KB (added by , 11 years ago) |
|---|
-
src/bp-messages/bp-messages-notifications.php
92 92 $email_content .= sprintf( __( 'To disable these notifications, please log in and go to: %s', 'buddypress' ), $settings_link ); 93 93 } 94 94 95 // Send the message 95 /** 96 * Filters the user email that the message notification will be sent to. 97 * 98 * @since BuddyPress (1.2.0) 99 * 100 * @param string $email_to User email the notification is being sent to. 101 * @param object $ud WP_User object of who is receiving the message. 102 */ 96 103 $email_to = apply_filters( 'messages_notification_new_message_to', $email_to, $ud ); 104 105 /** 106 * Filters the message notification subject that will be sent to user. 107 * 108 * @since BuddyPress (1.2.0) 109 * 110 * @param string $email_subject Email notification subject text. 111 * @param string $sender_name Name of the person who sent the message. 112 * @param object $ud WP_User object of who is receiving the message. 113 */ 97 114 $email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name, $ud ); 115 116 /** 117 * Filters the message notification message that will be sent to user. 118 * 119 * @since BuddyPress (1.2.0) 120 * 121 * @param string $email_content Email notification message text. 122 * @param string $sender_name Name of the person who sent the message. 123 * @param string $subject Email notification subject text. 124 * @param string $content Content of the message. 125 * @param string $message_link URL permalink for the message. 126 * @param string $settings_link URL permalink for the user's notification settings area. 127 * @param object $ud WP_User object of who is receiving the message. 128 */ 98 129 $email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud ); 99 130 100 131 wp_mail( $email_to, $email_subject, $email_content ); … … 101 132 } 102 133 } 103 134 135 /** 136 * Fires after the sending of a new message email notification. 137 * 138 * @since BuddyPress (1.5.0) 139 * 140 * @param array $recipients User IDs of recipients. 141 * @param string $email_subject Email notification subject text. 142 * @param string $email_content Email notification message text. 143 * @param array $$args Array of originally provided arguments. 144 */ 104 145 do_action( 'bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args ); 105 146 } 106 147 add_action( 'messages_message_sent', 'messages_notification_new_message', 10 ); … … 125 166 $total_items = (int) $total_items; 126 167 $link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox' ); 127 168 $title = __( 'Inbox', 'buddypress' ); 169 $amount = 'single'; 128 170 129 171 if ( 'new_message' === $action ) { 130 172 if ( $total_items > 1 ) { 131 173 $amount = 'multiple'; 132 174 $text = sprintf( __( 'You have %d new messages', 'buddypress' ), $total_items ); 175 $amount = 'multiple'; 133 176 } else { 134 177 $amount = 'single'; 135 178 … … 177 220 ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); 178 221 } 179 222 223 /** 224 * Fires right before returning the formatted message notifications. 225 * 226 * @since BuddyPress (1.0.0) 227 * 228 * @param string $action The type of message notification. 229 * @param int $item_id The primary item ID. 230 * @param int $secondary_item_id The secondary item ID. 231 * @param int $total_items Total amount of items to format. 232 */ 180 233 do_action( 'messages_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); 181 234 182 235 return $return;