Skip to content

[6.x] Fix CP header avatar for assets in private containers - #15611

Open
lazerg wants to merge 2 commits into
statamic:6.xfrom
lazerg:fix/issue-15605-private-avatar-header
Open

lazerg wants to merge 2 commits into
statamic:6.xfrom
lazerg:fix/issue-15605-private-avatar-header

Conversation

@lazerg

@lazerg lazerg commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

This pull request fixes an issue where the avatar in the CP header is a broken image when the user's avatar asset lives in a private container.

The header reads the user from JavascriptComposer::user(), which passes the augmented user to the front end. There avatar is the augmented asset, and its permalink is null because private containers have no URL, so the <img> gets no src.

This PR fixes it by setting avatar to $user->avatar(), which returns the CP thumbnail URL (or the Gravatar fallback). The Users listing already uses it, and the Avatar component already accepts a string.

avatar() used to throw when the avatar field augments to a query (no max_files: 1, or always_augment_to_query enabled). Now that it runs on every CP page, it takes the first asset from the query instead.

Fixes #15605

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CP header avatar has no src when the avatar asset is in a private container

1 participant