bp_document_media_library_list_view_document_attachment_image( array $attr, WP_Post $attachment, string $size )

Shows default icon for media in wordpress media library list view.

Description

Parameters

$attr

(Required) List of image attributes.

$attachment

(Required) Attachment Post object.

$size

(Required) Sizes for the image.

Return

(mixed)

Source

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

1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
function bp_document_media_library_list_view_document_attachment_image( $attr, $attachment, $size ) {
    if ( ! is_admin() ) {
        return $attr;
    }
 
    global $current_screen;
 
    if (
        empty( $current_screen )
        || ! isset( $current_screen->parent_file )
        || $current_screen->parent_file !== 'upload.php'
        || empty( $attachment )
        || empty( $attachment->ID )
    ) {
        return $attr;
    }
 
    $meta = get_post_meta( $attachment->ID, '_wp_attached_file', true );
    if ( empty( $meta ) ) {
        return $attr;
    }
 
    if ( strstr( $meta, 'bb_documents/' ) ) {
        $attr['src']   = includes_url() . 'images/media/default.png';
        $attr['style'] = "width:42px;height:60px;border:0;";
    }
 
    return $attr;
}

Changelog

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