Avatars Display Integration

Started by Pipke, February 15, 2020, 07:43:21 PM

Previous topic - Next topic

@rjen

Tip for a future version: the current code causes some validation errors...

Error: End tag had attributes.
At line 736, column 567
</span class="">

It seems there are some end tags in the code that cause this...

AvatarsDisplayIntegration.php (5 overeenkomsten)
    Regel 610:                            $context['categories'][$category['id']]['boards'][$board['id']]['css_class'] = 'adi_print '.$board['css_class'].'"><div class="adi_item_board">'.$context['adi']['open'].'<span class="avatar" '.adi_name2hex2rgb($board['last_post']['member']['name']).' '.adi_avatar_data(true).'>'.mb_strtoupper(mb_substr($board['last_post']['member']['name'], 0, 1), 'UTF-8').'</span>'.$context['adi']['close'].$context['adi']['iconstatus'].'</div><span></span class="';
    Regel 612:                            $context['categories'][$category['id']]['boards'][$board['id']]['css_class'] = 'adi_print '.$board['css_class'].'"><div class="adi_item_board">'.$context['adi']['open'].'<img class="avatar" src="'.$board['last_post']['member']['avatar']['href'].' alt="avatar_'.$board['last_post']['member']['name'].'" />'.$context['adi']['close'].$context['adi']['iconstatus'].'</div><span></span class="';
    Regel 799:                            $context['boards'][$board['id']]['css_class'] = 'adi_print '.$board['css_class'].'"><div class="adi_item_board">'.$context['adi']['open'].'<span '.adi_name2hex2rgb($board['last_post']['member']['name']).' class="avatar" '.adi_avatar_data(true).'>'.mb_strtoupper(mb_substr($board['last_post']['member']['name'], 0, 1), 'UTF-8').'</span>'.$context['adi']['close'].$context['adi']['iconstatus'].'</div><span></span class="';           
    Regel 801:                            $context['boards'][$board['id']]['css_class'] = 'adi_print '.$board['css_class'].'"><div class="adi_item_board">'.$context['adi']['open'].'<img class="avatar" src="'.$board['last_post']['member']['avatar']['url'].' alt="avatar_'.$board['last_post']['member']['name'].'" />'.$context['adi']['close'].$context['adi']['iconstatus'].'</div><span></span class="';               
    Regel 845:                    $context['topics'][$topic['id_topic']]['css_class'] = 'adi_print '.$topic['css_class'].'">'.$first.$last.'<span></span class="';
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Just found that this Mod is also messing with the avatars being displayed in my TinyPortal Articles and Blocks. I like the functionality this mod gives, but not when it affects areas it should not touch (IMO).

I cannot use it going forward...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Pipke

Quote from: @rjen on March 09, 2022, 09:09:39 AMJust found that this Mod is also messing with the avatars being displayed in my TinyPortal Articles and Blocks. I like the functionality this mod gives, but not when it affects areas it should not touch (IMO).

I cannot use it going forward...

Yes, this mod changes some global $context vars, because that's the idea, and yes, if other mods use them too, it affects them.
There is no way this mod will ever work 100% satisfactorily with all the other mods combined. If so, that wouldn't be great ;) dreams must be there, right...

ps. You could also ask: hey, can you maybe help me, how to fix that this mod won't transform the avatars on some blocks/pages from the Tinyportal mod. I'm just giving you a free hint..
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

@rjen

Thanks for the hint, do not take it the wrong way. I know what it means to maintain a mod, and I do not want to impose. If you have the time and interest to look into it, fine, if not also fine.

Just for your information:
the mod intervenes in the output of function set_avatar_data

This function is used in TinyPortal too, to retrieve avatars for blocks and articles.

Due to the avatar integration mod two issues occur:
1. The avatar data returned is extended with this extra attribute: data-adi="avatar"":

Results in validation errors:
Error: Saw " when expecting an attribute name. Probable cause: = missing immediately before.
ta-adi="avatar"" alt=""></a></

Resulting code is this:
Example:
<img class="avatar" src="https://test.fjr-club.nl/eigenavatars/avatar_691_1546366408.png" data-adi="avatar"" alt="">

2. The class added to avatars in article forces a width on the avatars

This results in this avatar code in articles:
<img class="avatar" src="https://test.fjr-club.nl/eigenavatars/avatar_3_1635710490.png" data-adi="avatar" "="" alt="">

due to this css the avatar is now resized to 36px..

.avatar[data-adi~="avatar"], .adi_initial[data-adi~="avatar"] {
    width: 36px;
    height: 36px;
    line-height: 34px;
    font-size: 22px;
    color: #ffffff;
    cursor: default;
}

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Pipke

#124
@@rjen
does this fix the blocks/articles -> double quote "
$image.='" '.adi_avatar_data(true);
to
$image.='" '.adi_avatar_data(false);

// For alerts and more...
function adi_integrate_set_avatar_data(&$image, &$data)
{
// Build the css data attibute. The only one we need here, so add it.
$image.='" '.adi_avatar_data(false);
}

if thats true, you can add a condition for tinyportal call(s), like when tinyportal has changed some $context before this function is called you can use that for reference true/false
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

FrizzleFried

I just thought of what I think would be a very good addition to this mod if the author is willing to add it...

We have square avatars...

We have round avatars...

What is missing?  Square avatars with rounded corners!

To make the mod even all that much better... perhaps one of the options for that mode could be the a user selectable number of pixels of roundedness... the more pixels the more rounded the corners.

:D

The rounded avatars are a hard-sell for my user base (I like them... they seem to not on a 3 to 1 basis).  The rounded corners option would be a real killer middle ground and it would go well with the stock Curve2 theme as well!

;)


FrizzleFried

Oh... and what are the chances this mod could be adapted to allow each user to select their own preference versus forcing it on everyone?  THAT would rectify the situation as well... (though I really do think a rounded corners option would rock as well!)

 ;D

peter_mein

Hello
I install this aktuell Mod.
But my Avatar look not good. See Picture.
If i change the settings Overwrite the default avatar with initial of displayname i became the
following error in the log file.
See Picture.

Avatars display integration 1.5.2
Forum 2.1.1

alex_cipher

Quote from: peter_mein on March 13, 2022, 07:12:36 AMHello
I install this aktuell Mod.
But my Avatar look not good. See Picture.
If i change the settings Overwrite the default avatar with initial of displayname i became the
following error in the log file.
See Picture.

Avatars display integration 1.5.2
Forum 2.1.1


Take the file from here
https://www.simplemachines.org/community/index.php?topic=571891.msg4115171#msg4115171

peter_mein

Thanks.
The error is no longer there.
Now how to change the Avatar picture ?
In the avatar is the initial of displayname and the background have a color.
In my forum no color in the avatar.

Pipke

you have somewhere some script maybe from other mod/manual edit, that it adds "color:black" to the style element of the avatar because of that it generates a "invalid property value", wich blocks the actual color code.

<span class="avatar" style="background-color: rgb(199,218,143) color: black;" data-adi="avatar shadow circle">V</span>
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

peter_mein

Which file must be changed it for this error ?

Pipke

Quote from: peter_mein on March 13, 2022, 04:36:36 PMWhich file must be changed it for this error ?


could be anything, try to un-install each mod at a time to see wich one effects it.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Pipke

Quote from: Bugo on March 06, 2022, 10:06:56 AMUpdated Russian translation
Quote from: gevv on March 08, 2022, 01:01:00 PMHi,


Turkish translation
both thx for that, its added to the latest version.

Mod updated.
Changelog
Version 1.5.3 - Mar 13, 2022
- Fixed Trying to access array offset on value of type null
- Added turkish language
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Pipke

Quote from: FrizzleFried on March 11, 2022, 01:46:53 PMI just thought of what I think would be a very good addition to this mod if the author is willing to add it...

We have square avatars...

We have round avatars...

What is missing?  Square avatars with rounded corners!

To make the mod even all that much better... perhaps one of the options for that mode could be the a user selectable number of pixels of roundedness... the more pixels the more rounded the corners.

:D

Thanks for the idea, i'll think about maybe adding this to the mod.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

peter_mein

Which file has to contain something for it to work?
Then I can compare with a test forum whether in the file
the same is in it. when I did the update from the forum,
I installed this avatar first. And there it was wrong. It worked before.

Shades.

#136
SMF2.1.1
Avatar Integration 1.5.3

I just noticed that some of the members avatars are oval and overlapping the "online status" and "buddy list" in the users profile summary.

Any way to fix?

You cannot view this attachment.You cannot view this attachment. 

But in the users post the edges of the avatar is rounded as it should be.

You cannot view this attachment.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Doug Heffernan

Quote from: Shades. on March 26, 2022, 06:05:55 AMSMF2.1.1
Avatar Integration 1.5.3

I just noticed that some of the members avatars are oval and overlapping the "online status" and "buddy list" in the users profile summary.

Any way to fix?

You cannot view this attachment.You cannot view this attachment. 

But in the users post the edges of the avatar is rounded as it should be.

You cannot view this attachment.

Does it happen in the default theme as well btw, or only in the custom(s) one?

Shades.

Quote from: Doug Heffernan on March 26, 2022, 09:03:27 AMDoes it happen in the default theme as well btw, or only in the custom(s) one?

Default as well!

You cannot view this attachment.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Speed King

Yes, this situation happens with all rectangular avatars, the square avatars are resized to circle normally.

Advertisement: