bp_document_forums_embed_attachments( $content,  $id )

Embed topic or reply attachments in a post.

Description

Parameters

$content

(Required)

$id

(Required)

Return

(string)

Source

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

564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
function bp_document_forums_embed_attachments( $content, $id ) {
 
    // Do not embed attachment in wp-admin area.
    if ( is_admin() ) {
        return $content;
    }
 
    $document_ids = get_post_meta( $id, 'bp_document_ids', true );
 
    if ( ! empty( $document_ids ) && bp_has_document(
        array(
            'include'  => $document_ids,
            'order_by' => 'menu_order',
            'sort'     => 'ASC',
            'privacy'  => array( 'forums' ),
        )
    ) ) {
        ob_start();
        ?>
        <div class="bb-activity-media-wrap forums-media-wrap">
            <?php
            while ( bp_document() ) {
                bp_the_document();
                bp_get_template_part( 'document/activity-entry' );
            }
            ?>
        </div>
        <?php
        $content .= ob_get_clean();
    }
 
    return $content;
}

Changelog

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