BuddyPress::notification_new_comment( integer $item_id, integer $secondary_item_id, integer $total_items, string $format, integer $id )
Description #
Format comments notifications.
Parameters #
- $item_idinteger (Required) Item id.
- $secondary_item_idinteger (Required) Secondary item.
- $total_itemsinteger (Required) Total items.
- $formatstring (Required) Notification type.
- $idinteger (Required) Notification id.
Source #
File: addons/buddypress/buddypress.php
private function notification_new_comment( $item_id, $secondary_item_id, $total_items, $format, $id ) { $comment = get_comment( $item_id ); $post = get_post( $comment->comment_post_ID ); $link = get_comment_link( $comment ); $author = get_comment_author( $comment ); $type = 'question' === $post->post_type ? __( 'question', 'anspress-question-answer' ) : __( 'answer', 'anspress-question-answer' ); $title = substr( wp_strip_all_tags( $post->post_title ), 0, 35 ) . ( strlen( $post->post_title ) > 35 ? '...' : '' ); if ( 'string' === $format ) { if ( (int) $total_items > 1 ) { // translators: first - comments count, second - post title, third - post type. return '<a href="' . esc_url( $link ) . '">' . sprintf( __( '%1$d comments on your %3$s - %2$s', 'anspress-question-answer' ), (int) $total_items, $title, $type ) . '</a>'; } // translators: first - comments count, second - post title, third - post type. return '<a href="' . esc_url( $link ) . '">' . sprintf( __( '%1$s commented on your %3$s - %2$s', 'anspress-question-answer' ), $author, $title, $type ) . '</a>'; } return array( 'link' => $link, 'text' => $title, ); }
Expand full source code Collapse full source code View on GitHub: addons/buddypress/buddypress.php:507
Add your comment