Albums
Albums are unique to files and operate differently than collections. While collections are shared by groups and used to organize favorites for entries, members, and files, albums are owned by individual users and contain only files that the user has added.
Each album can be set to either public or private. Public albums are visible to all site visitors, allowing users to share their file collections with others. Private albums are only visible to the album owner, providing a way for users to organize files for their personal use. When viewing another user's albums, only their public albums will be displayed.
Key differences between Albums and Collections:
- Collections are global and shared by all users. They're pre-defined by administrators and used to organize favorites across the site.
- Albums are personal and owned by individual users. Each user creates their own albums to organize files they've added. Albums can be set to public (visible to others) or private (only visible to the owner).
Albums allow users to create their own organizational structure for files, independent of the favorites system. A file can be in an album without being favorited, and a file can be favorited without being in an album.
{exp:favorites:albums}
Lists all albums for a specific user or the currently logged-in user.
{exp:favorites:albums}
<div class="album">
<h3>{album_name}</h3>
<p>Created: {created_date format="%F %j, %Y"}</p>
<p>Privacy: {privacy}</p>
<p>Files: {file_count}</p>
</div>
{/exp:favorites:albums}
Album Variables:
{album_id}- The ID of the album{album_name}- The name of the album{privacy}- The privacy setting (public or private){created_date}- The date the album was created (requires format parameter){file_count}- The number of files in the album{count}- Current row count{total_results}- Total number of results
Album Parameters:
member_id- The member ID to list albums for. Defaults to currently logged-in user.privacy- Filter by privacy setting. Options: all, public, private. Default: allalbum_id- Limit to a specific album IDorderby- Order results by field. Options: created_date, album_name. Default: created_datesort- Sort direction. Options: asc, desc. Default: desclimit- Limit number of results. Default: 20offset- Offset results. Default: 0
Default Privacy Handling: By default (when member_id is omitted), this tag displays all albums (both public and private) for the currently logged-in user. If member_id is specified to view another user's albums, only their public albums will be displayed; their private albums remain hidden from other users.
{exp:favorites:album_files}
Lists all files contained within a specific album.
{exp:favorites:album_files album_id="{segment_3}"}
<div class="file">
<img src="{file_url}" alt="{file_name}">
<h4>{title}</h4>
<p>Added: {added_date format="%F %j, %Y"}</p>
</div>
{/exp:favorites:album_files}
Album File Variables:
{file_id}- The ID of the file{file_name}- The name of the file{title}- The title of the file{file_url}- The full URL to the file{is_image}- Whether the file is an image (yes/no){added_date}- The date the file was added to the album (requires format parameter){album_name}- The name of the album{count}- Current row count{total_results}- Total number of results
Album File Parameters:
album_id- The ID of the album to list files from. Required.orderby- Order results by field. Options: added_date, file_name. Default: added_datesort- Sort direction. Options: asc, desc. Default: desclimit- Limit number of results. Default: 20offset- Offset results. Default: 0
Default Privacy Handling: If the specified album is set to private, its files will only be displayed if the currently logged-in user is the owner of the album. Other users attempting to view files in a private album will see no results (the tag will return the {if no_results} content).
{exp:favorites:album_form}
Displays a form that allows users to create a new album or edit an existing one.
{exp:favorites:album_form album_id="{segment_3}"}
<input type="text" name="album_name" value="{album_name}" placeholder="Album Name">
<select name="privacy">
<option value="private" {if privacy == 'private'}selected{/if}>Private</option>
<option value="public" {if privacy == 'public'}selected{/if}>Public</option>
</select>
<button type="submit">Save Album</button>
{/exp:favorites:album_form}
Album Form Variables:
{album_name}- The name of the album. Use this to pre-populate the input field when editing.{privacy}- The privacy setting of the album. Use this to pre-select the privacy option when editing.
Album Form Parameters:
album_id- If provided, the form will be in "edit mode" for the specified album ID. If omitted, it will create a new album.return- URL to return to after submission. Default: Current URLerror_page- Custom error page template
Default Privacy Handling: This form only allows users to create new albums for themselves or edit albums they own. Users cannot edit albums belonging to other users, regardless of whether those albums are public or private.
{exp:favorites:add_to_album_form}
Displays a form that allows users to add a file to one or more albums.
{exp:favorites:add_to_album_form file_id="{file_id}"}
<label>Add to Albums:</label>
{albums}
<label>
<input type="checkbox" name="albums[]" value="{album_id}" {checked}>
{album_name}
</label>
{/albums}
<button type="submit">Update</button>
{/exp:favorites:add_to_album_form}
Add to Album Variables:
Within the {albums} variable pair:
{album_id}- The album ID{album_name}- The album name{checked}- Helper for checkbox state. Outputs "checked" if the file is already in the album
Add to Album Parameters:
file_id- The file ID to add to albums. Required.return- URL to return to after submissionerror_page- Custom error page template
Default Privacy Handling: This form only lists albums belonging to the currently logged-in user. Users can only add files to their own albums, regardless of privacy settings.
{exp:favorites:info} with Albums
The Info tag includes album functionality when working with files. Use the include_albums parameter to display albums alongside favorites data.
{exp:favorites:info file_id="{file_id}" include_albums="yes"}
{if is_favorite}
<p>Saved to {favorites:collection_name}</p>
{/if}
{albums}
<p>In album: {album_name}</p>
{/albums}
{/exp:favorites:info}
Album Variables in Info Tag:
{albums}- Variable pair that loops through albums the file belongs to{album_name}- The name of the album (within albums loop){album_id}- The album ID (within albums loop){is_favorite}/{favorites:is_favorite}- Outputs "1" if the file is favorited, empty string if not
Album Parameters in Info Tag:
include_albums- When set to "yes" and type is "file", includes files that are in albums (even if not favorited) in the results. Default: no
When include_albums="yes" is used, albums will display even if the file isn't favorited, making it useful for showing all organizational data for a file.
Default Privacy Handling: When checking the currently logged-in user (default behavior when no favoriter_id is specified), all albums (both public and private) containing the file are listed. If checking another user's favorites (via the favoriter_id parameter), only their public albums containing the file are displayed; their private albums remain hidden.