bp_activity_format_activity_action_custom_post_type_comment( string $action, object $activity )
Format activity action strings for custom post types comments.
Description
Parameters
- $action
-
(Required) Static activity action.
- $activity
-
(Required) Activity data object.
Return
(string)
Source
File: bp-activity/bp-activity-functions.php
function bp_activity_format_activity_action_custom_post_type_comment( $action, $activity ) { $bp = buddypress(); // Fetch all the tracked post types once. if ( empty( $bp->activity->track ) ) { $bp->activity->track = bp_activity_get_post_types_tracking_args(); } if ( empty( $activity->type ) || empty( $bp->activity->track[ $activity->type ] ) ) { return $action; } $user_link = bp_core_get_userlink( $activity->user_id ); if ( is_multisite() ) { $blog_link = '<a href="' . esc_url( get_home_url( $activity->item_id ) ) . '">' . get_blog_option( $activity->item_id, 'blogname' ) . '</a>'; if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms ) ) { $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms, $user_link, $activity->primary_link, $blog_link ); } else { $action = sprintf( __( '%1$s commented on the <a href="%2$s">item</a>, on the site %3$s', 'buddyboss' ), $user_link, $activity->primary_link, $blog_link ); } } else { if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_comment_action ) ) { $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action, $user_link, $activity->primary_link ); } else { $action = sprintf( __( '%1$s commented on the <a href="%2$s">item</a>', 'buddyboss' ), $user_link, $activity->primary_link ); } } /** * Filters the formatted custom post type activity comment action string. * * @since BuddyPress 2.5.0 * * @param string $action Activity action string value. * @param BP_Activity_Activity $activity Activity item object. */ return apply_filters( 'bp_activity_custom_post_type_comment_action', $action, $activity ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.5.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.