BP_Media::get_album_media_ids( bool $album_id = false )

Get all media ids for the album

Description

Parameters

$album_id

(Optional)

Default value: false

Return

(array|bool)

Source

File: bp-media/classes/class-bp-media.php

	public static function get_album_media_ids( $album_id = false ) {

		if ( ! $album_id ) {
			return false;
		}

		global $wpdb;

		$bp = buddypress();

		// Select conditions.
		$select_sql = "SELECT DISTINCT m.id FROM {$bp->media->table_name} m WHERE m.album_id = {$album_id}";

		$cache_group = 'bp_media_album_media_ids';

		$cached = bp_core_get_incremented_cache( $select_sql, $cache_group );
		if ( false === $cached ) {
			$media_ids = $wpdb->get_col( $select_sql );
			bp_core_set_incremented_cache( $select_sql, $cache_group, $media_ids );
		} else {
			$media_ids = $cached;
		}

		return $media_ids;
	}

Changelog

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