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

1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
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.