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

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.