bp_album_get( array|string $args = '' )

Retrieve an album or albums.

Description

The bp_album_get() function shares all arguments with BP_Media_Album::get(). The following is a list of bp_album_get() parameters that have different default values from BP_Media_Album::get() (value in parentheses is the default for the bp_album_get()).

  • ‘per_page’ (false)

See also

  • BP_Media_Album::get(): For more information on accepted arguments and the format of the returned value.

Parameters

$args

(Optional) See BP_Media_Album::get() for description.

Default value: ''

Return

(array) $activity See BP_Media_Album::get() for description.

Source

File: bp-media/bp-media-functions.php

function bp_album_get( $args = '' ) {

	$r = bp_parse_args( $args, array(
		'max'      => false,                    // Maximum number of results to return.
		'fields'   => 'all',
		'page'     => 1,                        // Page 1 without a per_page will result in no pagination.
		'per_page' => false,                    // results per page
		'sort'     => 'DESC',                   // sort ASC or DESC

		'search_terms'      => false,           // Pass search terms as a string
		'exclude'           => false,           // Comma-separated list of activity IDs to exclude.
		// want to limit the query.
		'user_id'  => false,
		'group_id' => false,
		'privacy'  => false,                    // privacy of album
		'count_total'       => false,
	), 'album_get' );

	$album = BP_Media_Album::get( array(
		'page'              => $r['page'],
		'per_page'          => $r['per_page'],
		'user_id'           => $r['user_id'],
		'group_id'          => $r['group_id'],
		'privacy'           => $r['privacy'],
		'max'               => $r['max'],
		'sort'              => $r['sort'],
		'search_terms'      => $r['search_terms'],
		'exclude'           => $r['exclude'],
		'count_total'       => $r['count_total'],
		'fields'            => $r['fields'],
	) );

	/**
	 * Filters the requested album item(s).
	 *
	 * @since BuddyBoss 1.0.0
	 *
	 * @param BP_Media  $album Requested media object.
	 * @param array     $r     Arguments used for the album query.
	 */
	return apply_filters_ref_array( 'bp_album_get', array( &$album, &$r ) );
}

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.