Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{ avatar }} doesn't fetch value as expected. #2017

Closed
Rovaski opened this issue Jul 2, 2020 · 2 comments
Closed

{{ avatar }} doesn't fetch value as expected. #2017

Rovaski opened this issue Jul 2, 2020 · 2 comments

Comments

@Rovaski
Copy link

Rovaski commented Jul 2, 2020

Bug Description

When in {{ users }} {{ /users }}; if you try to fetch the avatar handle {{ avatar }} you don't get anything returned.

How to Reproduce

Try to grab {{ avatar }} on the front-end.

Extra Detail

I believe auth/users.php method, avatar is blocking {{ avatar }} from working.

However, if you modify the following from


        if ($this->hasAvatarField()) {
            return $this->avatarFieldUrl();
        }

to


        if ($this->hasAvatarField()) {
            return $this->get('avatar');
        }

{{ avatar }} starts working on the frontend, but in the CP, the avatar image's are broken unless you prepend /assets/ to all the avatar urls.

Perhaps avatarFieldUrl(); isn't working/returning the correct value?

    protected function avatarFieldUrl()
    {
        $value = (new Value($this->get('avatar'), 'avatar', $this->blueprint()->field('avatar')->fieldtype(), $this));

        return $value->value()->url();
    }
@caseydwyer
Copy link
Contributor

caseydwyer commented Aug 12, 2020

Similar issue over here, and had same results when making @Rovaski's above change to the avatar method in Auth\User.
An {{ avatar }} tag within a User context on the front end starts working, but images are broken in the cp.

@duncanmcclean
Copy link
Member

duncanmcclean commented Sep 16, 2020

I've submitted a pull request (#2443) to fix this bug, it was only a three line fix 😂.

Hopefully it'll be merged soon!

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 a pull request may close this issue.

3 participants