BuddyPress::notification_new_answer( integer $item_id, integer $secondary_item_id, integer $total_items, string $format, integer $id )
Description #
Format answer 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_answer( $item_id, $secondary_item_id, $total_items, $format, $id ) {
$post = get_post( $item_id );
$link = get_permalink( $post );
$author = bp_core_get_user_displayname( $secondary_item_id );
$title = substr( wp_strip_all_tags( $post->post_title ), 0, 35 ) . ( strlen( $post->post_title ) > 35 ? '...' : '' );
if ( 'string' === $format ) {
if ( (int) $total_items > 1 ) {
return '<a href="' . esc_url( $link ) . '">' . sprintf(
// translators: First placeholder is total count and second is question title.
__( '%1$d answers on your question - %2$s', 'anspress-question-answer' ),
(int) $total_items,
$title
) . '</a>';
}
// translators: First placeholder is total count and second is question title.
return '<a href="' . esc_url( $link ) . '">' . sprintf( __( '%1$s answered on your question - %2$s', 'anspress-question-answer' ), $author, $title ) . '</a>';
}
return array(
'link' => $link,
// translators: placeholder contains question title.
'text' => sprintf( __( 'New answer on %s', 'anspress-question-answer' ), $title ),
);
}
Expand full source code Collapse full source code View on GitHub: addons/buddypress/buddypress.php:468
Add your comment