MyBB Community Forums

Full Version: Default avatar not showing in member profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using a custom theme and having a problem with the default avatar not showing. I've used the default avatar fix plugin but it still doesn't show.

[Image: Screenshot-1.png]

<img loading="lazy" class="rounded-circle" src="{$memprofile['avatar']}" />

and how to get url profile from lastpost? i tried {$lastpost_profilelink} but not work i have code like this


<a href=''>{$forum['lp_avatar']} </a>
$forum['lp_avatar'] isn't defined anywhere so that isn't going to work.

Where you are putting $memprofile['avatar']? This will only work on a profile page, but the avatar is already being displayed there.
(2022-05-09, 10:30 AM)Matt Wrote: [ -> ]$forum['lp_avatar'] isn't defined anywhere so that isn't going to work.

Where you are putting $memprofile['avatar']? This will only work on a profile page, but the avatar is already being displayed there.

I added a lp_avatar on fuction_forumlist.php 


if ($user['avatar'] != "")
{
    $forum['lp_avatar'] = '<img src="' . $user['avatar'] . '" height="25" width="25" title="' . $user['username'] . ' \'s avatar." alt="" />';
}
else
{
    $forum['lp_avatar'] = '<img src="images/default_avatar.png" height="25" width="25" title="Default Avatar" alt="" />';
}

$memprofile['avatar'] I added it on member profile, I've changed it to like this and now it works

<img loading="lazy" class="rounded-circle" src="{$useravatar['image']}" />
If in the future someone comes across this and does not want to edit core files, here is an alternative that works.

<img src="{$mybb->user['avatar']}" onerror="this.onerror=null;this.src='{$mybb->settings['bburl']}/images/default_avatar.png';"></img>

{$mybb->user['avatar']} being interchangeable with your needs/page in use.
(2022-05-09, 10:18 PM)Taylor M Wrote: [ -> ]If in the future someone comes across this and does not want to edit core files, here is an alternative that works.

<img src="{$mybb->user['avatar']}" onerror="this.onerror=null;this.src='{$mybb->settings['bburl']}/images/default_avatar.png';"></img>

{$mybb->user['avatar']} being interchangeable with your needs/page in use.

I've fixed it, one unresolved problem. how to display the profile link url on the last poster?

<a href='url profile last poster'>{$forum['lp_avatar']} </a>

solved im use this

<a href="member.php?action=profile&amp;uid={$uid}">{$forum['lp_avatar']} </a>