bp_blogs_activity_comment_content_with_read_more( $content,  $activity )

Function which set the content on activity blog post comment.

Description

Parameters

$content

(Required)

$activity

(Required)

Return

(string)

Source

File: bp-activity/bp-activity-filters.php

2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
function bp_blogs_activity_comment_content_with_read_more( $content, $activity ) {
 
    if( 'activity_comment' === $activity->type && $activity->item_id && $activity->item_id > 0 ) {
        // Get activity object.
        $comment_activity = new BP_Activity_Activity( $activity->item_id );
        if( 'blogs' === $comment_activity->component && isset( $comment_activity->secondary_item_id ) && 'new_blog_' . get_post_type( $comment_activity->secondary_item_id ) === $comment_activity->type ) {
            $comment_post_type = $comment_activity->secondary_item_id;
            $get_post_type     = get_post_type( $comment_post_type );
            $comment_id        = bp_activity_get_meta( $activity->id, 'bp_blogs_' . $get_post_type . '_comment_id', true );
            if( $comment_id ) {
                $comment = get_comment( $comment_id );
                $content = bp_create_excerpt( html_entity_decode( $comment->comment_content ) );
                if( false !== strrpos( $content, __( '…', 'buddyboss' ) ) ) {
                    $content     = str_replace( ' […]', '…', $content );
                    $append_text = apply_filters( 'bp_activity_excerpt_append_text', __( ' Read more', 'buddyboss' ) );
                    $content     = sprintf( '%1$s<span class="activity-blog-post-link"><a href="%2$s" rel="nofollow">%3$s</a></span>', $content, get_comment_link( $comment_id ), $append_text );
                }
            }
        }
    }
 
    return $content;
}

Changelog

Changelog
Version Description
BuddyBoss 1.5.5 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.