Changeset 9134 for trunk/src/bp-activity/bp-activity-notifications.php
- Timestamp:
- 11/11/2014 07:53:48 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-notifications.php
r8095 r9134 16 16 * Send email and BP notifications when a user is mentioned in an update. 17 17 * 18 * @since BuddyPress (1.2 )18 * @since BuddyPress (1.2.0) 19 19 * 20 20 * @uses bp_notifications_add_notification() … … 100 100 } 101 101 102 // Send the message 102 /** 103 * Filters the user email that the @mention notification will be sent to. 104 * 105 * @since BuddyPress (1.2.0) 106 * 107 * @param string $to User email the notification is being sent to. 108 */ 103 109 $to = apply_filters( 'bp_activity_at_message_notification_to', $to ); 110 111 /** 112 * Filters the @mention notification subject that will be sent to user. 113 * 114 * @since BuddyPress (1.2.0) 115 * 116 * @param string $subject Email notification subject text. 117 * @param string $poster_name Name of the person who made the @mention. 118 */ 104 119 $subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name ); 120 121 /** 122 * Filters the @mention notification message that will be sent to user. 123 * 124 * @since BuddyPress (1.2.0) 125 * 126 * @param string $message Email notification message text. 127 * @param string $poster_name Name of the person who made the @mention. 128 * @param string $content Content of the @mention. 129 * @param string $message_link URL permalink for the activity message. 130 * @param string $settings_link URL permalink for the user's notification settings area. 131 */ 105 132 $message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link ); 106 133 … … 108 135 } 109 136 137 /** 138 * Fires after the sending of an @mention email notification. 139 * 140 * @since BuddyPress (1.5.0) 141 * 142 * @param BP_Activity_Activity $activity Activity Item object. 143 * @param string $subject Email notification subject text. 144 * @param string $message Email notification message text. 145 * @param string $content Content of the @mention. 146 * @param int $receiver_user_id The ID of the user who is receiving the update. 147 */ 110 148 do_action( 'bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id ); 111 149 } … … 114 152 * Send email and BP notifications when an activity item receives a comment. 115 153 * 116 * @since BuddyPress (1.2 )154 * @since BuddyPress (1.2.0) 117 155 * 118 156 * @uses bp_get_user_meta() … … 178 216 } 179 217 180 /* Send the message */ 218 /** 219 * Filters the user email that the new comment notification will be sent to. 220 * 221 * @since BuddyPress (1.2.0) 222 * 223 * @param string $to User email the notification is being sent to. 224 */ 181 225 $to = apply_filters( 'bp_activity_new_comment_notification_to', $to ); 226 227 /** 228 * Filters the new comment notification subject that will be sent to user. 229 * 230 * @since BuddyPress (1.2.0) 231 * 232 * @param string $subject Email notification subject text. 233 * @param string $poster_name Name of the person who made the comment. 234 */ 182 235 $subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name ); 236 237 /** 238 * Filters the new comment notification message that will be sent to user. 239 * 240 * @since BuddyPress (1.2.0) 241 * 242 * @param string $message Email notification message text. 243 * @param string $poster_name Name of the person who made the comment. 244 * @param string $content Content of the comment. 245 * @param string $thread_link URL permalink for the activity thread. 246 * @param string $settings_link URL permalink for the user's notification settings area. 247 */ 183 248 $message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link ); 184 249 185 250 wp_mail( $to, $subject, $message ); 186 251 252 /** 253 * Fires after the sending of a reply to an update email notification. 254 * 255 * @since BuddyPress (1.5.0) 256 * 257 * @param int $user_id ID of the original activity item author. 258 * @param string $subject Email notification subject text. 259 * @param string $message Email notification message text. 260 * @param int $comment_id ID for the newly received comment. 261 * @param int $commenter_id ID of the user who made the comment. 262 * @param array $params Arguments used with the original activity comment. 263 */ 187 264 do_action( 'bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params ); 188 265 } … … 227 304 } 228 305 229 /* Send the message */ 306 /** 307 * Filters the user email that the new comment reply notification will be sent to. 308 * 309 * @since BuddyPress (1.2.0) 310 * 311 * @param string $to User email the notification is being sent to. 312 */ 230 313 $to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to ); 314 315 /** 316 * Filters the new comment reply notification subject that will be sent to user. 317 * 318 * @since BuddyPress (1.2.0) 319 * 320 * @param string $subject Email notification subject text. 321 * @param string $poster_name Name of the person who made the comment reply. 322 */ 231 323 $subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name ); 324 325 /** 326 * Filters the new comment reply notification message that will be sent to user. 327 * 328 * @since BuddyPress (1.2.0) 329 * 330 * @param string $message Email notification message text. 331 * @param string $poster_name Name of the person who made the comment reply. 332 * @param string $content Content of the comment reply. 333 * @param string $settings_link URL permalink for the user's notification settings area. 334 * @param string $thread_link URL permalink for the activity thread. 335 */ 232 336 $message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link ); 233 337 234 338 wp_mail( $to, $subject, $message ); 235 339 340 /** 341 * Fires after the sending of a reply to a reply email notification. 342 * 343 * @since BuddyPress (1.5.0) 344 * 345 * @param int $user_id ID of the original activity item author. 346 * @param string $subject Email notification subject text. 347 * @param string $message Email notification message text. 348 * @param int $comment_id ID for the newly received comment. 349 * @param int $commenter_id ID of the user who made the comment. 350 * @param array $params Arguments used with the original activity comment. 351 */ 236 352 do_action( 'bp_activity_sent_reply_to_reply_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params ); 237 353 } … … 255 371 * Format notifications related to activity. 256 372 * 257 * @since BuddyPress (1.5 )373 * @since BuddyPress (1.5.0) 258 374 * 259 375 * @uses bp_loggedin_user_domain() … … 279 395 $at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; 280 396 $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ); 397 $amount = 'single'; 281 398 282 399 if ( (int) $total_items > 1 ) { 283 400 $text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items ); 284 $ filter = 'bp_activity_multiple_at_mentions_notification';401 $amount = 'multiple'; 285 402 } else { 286 403 $user_fullname = bp_core_get_user_displayname( $poster_user_id ); 287 404 $text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname ); 288 $filter = 'bp_activity_single_at_mentions_notification';289 405 } 290 406 break; … … 292 408 293 409 if ( 'string' == $format ) { 294 $return = apply_filters( $filter, '<a href="' . esc_url( $at_mention_link ) . '" title="' . esc_attr( $at_mention_title ) . '">' . esc_html( $text ) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id ); 410 411 /** 412 * Filters the @mention notification for the string format. 413 * 414 * This is a variable filter that is dependent on how many items 415 * need notified about. The two possible hooks are bp_activity_single_at_mentions_notification 416 * or bp_activity_multiple_at_mentions_notification. 417 * 418 * @since BuddyPress (1.5.0) 419 * 420 * @param string $string HTML anchor tag for the mention. 421 * @param string $at_mention_link The permalink for the mention. 422 * @param int $total_items How many items being notified about. 423 * @param int $activity_id ID of the activity item being formatted. 424 * @param int $poster_user_id ID of the user posting the mention. 425 */ 426 $return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', '<a href="' . esc_url( $at_mention_link ) . '" title="' . esc_attr( $at_mention_title ) . '">' . esc_html( $text ) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id ); 295 427 } else { 296 $return = apply_filters( $filter, array( 428 429 /** 430 * Filters the @mention notification for any non-string format. 431 * 432 * This is a variable filter that is dependent on how many items need notified about. 433 * The two possible hooks are bp_activity_single_at_mentions_notification 434 * or bp_activity_multiple_at_mentions_notification. 435 * 436 * @since BuddyPress (1.5.0) 437 * 438 * @param array $array Array holding the content and permalink for the mention notification. 439 * @param string $at_mention_link The permalink for the mention. 440 * @param int $total_items How many items being notified about. 441 * @param int $activity_id ID of the activity item being formatted. 442 * @param int $poster_user_id ID of the user posting the mention. 443 */ 444 $return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', array( 297 445 'text' => $text, 298 446 'link' => $at_mention_link … … 300 448 } 301 449 450 /** 451 * Fires right before returning the formatted activity notifications. 452 * 453 * @since BuddyPress (1.2.0) 454 * 455 * @param string $action The type of activity item. 456 * @param int $item_id The activity ID. 457 * @param int $secondary_item_id @mention mentioner ID. 458 * @param int $total_items Total amount of items to format. 459 */ 302 460 do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); 303 461 … … 339 497 * Mark at-mention notifications as read when users visit their Mentions page. 340 498 * 341 * @since BuddyPress (1.5 )499 * @since BuddyPress (1.5.0) 342 500 * 343 501 * @uses bp_notifications_mark_all_notifications_by_type()
Note: See TracChangeset
for help on using the changeset viewer.