2010-12-20, 01:46 AM
2010-12-20, 01:50 AM
<img src="{$mybb->user['avatar']}" alt="Avatar" width="90px"; height="90px"; style="margin-top: 0px;">
2010-12-20, 01:55 AM
[Removed]
2010-12-20, 01:56 AM
Don't know. I leave it as a broken image, they either deal with it or use an avatar.
2010-12-20, 01:59 AM
Use this if you want to display a default avatar if users don't upload one - http://mods.mybb.com/view/default-avatar
2010-12-20, 01:59 AM
(2010-12-20, 01:55 AM)flav1us Wrote: [ -> ]What if the user doesn't have an avatar and I want to display a default one?
I think you need to do a query or a plugin to do that, But if you did this with some edits it shoud work.
http://www.webdesignerwall.com/tutorials...th-jquery/
2010-12-20, 05:21 AM
A little jQuery can get the problem solved. Give the user's avatar a class of "avatar" and have another class "avatar2" or something different to display the default avatar as a background image.
So
Then, add the jQuery:
So
.avatar2 {
background: url(images/theme/avatar2.png) top left no-repeat;
height: 90px;
width: 90px;
}
Then, add the jQuery:
if (jQuery('.avatar').attr('src') == '') {
jQuery('.avatar').addClass('avatar2');
}
2010-12-20, 05:37 AM
Is this for a personal site? If so, look into a plugin that inserts a default avatar, or install the PHP Conditionals plugin. I don't see why you would want to load up jQuery for one thing.