Ad

OctoberCMS - User Avatar In Rainlab Blog Not Showing

- 1 answer

I am new to Octobercms and trying to create a blog website, I have installed rainlab blog plugin and it is working good.

In the post detail page, I need to show Author avatar but I am not able to fetch it, when I print

{{ post.user }} it shows user details

{"id":1,"first_name":"Test User","last_name":"Test","login":"admin","email":"[email protected]","permissions":"","is_activated":true,"role_id":2,"activated_at":null,"last_login":"2019-01-28 10:43:57","created_at":"2019-01-03 06:44:43","updated_at":"2019-02-06 11:54:01","deleted_at":null,"is_superuser":1}

but nothing about the avatar. Please tell me how can I get Author avatar url in the front-end.

Ad

Answer

Use this

{{ post.user.getAvatarThumb(25) }}

25 - size of avatar

<img src="{{ post.user.getAvatarThumb(25) }}" />

if any doubt please comment.

Ad
source: stackoverflow.com
Ad