[Liam W] (RIP) Mentions Mini Avatars

[Liam W] (RIP) Mentions Mini Avatars 2.0.0 Patch Level 1

No permission to download

Liam W

in memoriam 1998-2020
Liam W submitted a new resource:

Mentions Mini Avatars - Show user avatars with mentions

This install-and-done add-on will add user avatars to the left of any mentions of them.

This add-on uses the XF2 'embed metadata' system to store the mentioned users with each message. This means that for any message created after this add-on is installed, there will only be one additional query per thread for the user avatars.

For messages created before this add-on is installed, there is an option to control what you wish to happen. This provides three alternatives:
  • ...

Read more about this resource...
 

easiii

Well-known member
Hey @Liam W,
Thank you for this add-on. I've requested something like this before: https://xenforo.com/community/threads/improve-the-username-look-xenforo-2.157570/

Your add-on is great but it can be improved:

  1. We want to be able to remove the @ sign.
  2. 0 queries - @Jeremy P did it for it's https://xenforo.com/community/resources/mini-avatar-with-tag.3738/ addon so it should be possible.
  3. Will this work for all the Xenforo parts, even on Profile posts and Conversations?
  4. Styling should be controlled via style properties
 

Liam W

in memoriam 1998-2020
I am planning on making improvements, this is an initial beta.

We want to be able to remove the @ sign.

This add-on respects the existing option. Adding an additional option would almost certain confuse things.

0 queries - @Jeremy P did it for it's https://xenforo.com/community/resources/mini-avatar-with-tag.3738/ addon so it should be possible.

I'm not sure how that works, but if it is zero additional queries, then it's probably caching the avatar data somewhere. That would lead to outdated avatars - I will take a look though.

Will this work for all the Xenforo parts, even on Profile posts and Conversations?

Yes, but until beta 2 only if 'Always' is selected in the options.

Styling should be controlled via style properties

Planned.
 

Liam W

in memoriam 1998-2020
@easiii I've taken a look at that add-on, and it doesn't support Gravatar's and also breaks the avatar image cache busting for browser caching. I could add an option to do something similar in this add-on, but I'm currently mostly against it.
 

easiii

Well-known member
@easiii I've taken a look at that add-on, and it doesn't support Gravatar's. I could add an option to do something similar in this add-on - only support uploaded image avatars, and fallback onto the default avatar for Gravatar's, if that would interest you.
I've disabled Gravatar's on my board so it would be a great option to have 0 queries. : D

This add-on respects the existing option. Adding an additional option would almost certain confuse things.
It could be something in the add-on option:
190463

Have an avatar then @, then username isn't very good looking...

Yes, but until beta 2 only if 'Always' is selected in the options.
I'm using the latest stable Xenforo 2.0.12 so it should work right?

Thank you for taking your time for this! I really appreciate it!
 

easiii

Well-known member
@easiii I've taken a look at that add-on, and it doesn't support Gravatar's and also breaks the avatar image cache busting for browser caching. I could add an option to do something similar in this add-on, but I'm currently mostly against it.
Oh ok, if you think it's not a good idea then it's fine. Just to be clear, this add-on will add 1 query no matter how many mentions are on a page. So if on a page there will be mentioned 30 users, there will be still 1 query right?
 

Liam W

in memoriam 1998-2020
Oh ok, if you think it's not a good idea then it's fine. Just to be clear, this add-on will add 1 query no matter how many mentions are on a page. So if on a page there will be mentioned 30 users, there will be still 1 query right?

Yes, that's the default. It should be noted that (by default) only mentions in messages created or edited after this add-on is installed will have avatars, unless that mentioned user has been loaded from the database in that request (which, depending on how mentions are used on your board, may be all of them).
 

easiii

Well-known member
Yes, that's the default. It should be noted that (by default) only mentions in messages created or edited after this add-on is installed will have avatars, unless that mentioned user has been loaded from the database in that request (which, depending on how mentions are used on your board, may be all of them).
Sounds good. I'll give this add-on a test on my test board and let you know what happens! Thank you!
 

easiii

Well-known member
Hey @Liam W,
Thanks for the update!

We have a problem when we mention a user in the Profile posts widget or page. Basically it does not do show the avatar, and shows in the ACP the below errors (we got like 12 pages) :
  • Accessed unknown getter 'embed_metadata' on XF:profilePostComment
  • Accessed unknown getter 'embed_metadata' on XF:profilePost
Code:
InvalidArgumentException: Accessed unknown getter 'embed_metadata' on XF:ProfilePost[35783]
src/XF/Mvc/Entity/Entity.php:182
Generated by
Dec 14, 2018
Stack trace

#0 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('embed_metadata')
#1 src/addons/LiamW/MentionMiniAvatar/Repository/Mentions.php(19): XF\Mvc\Entity\Entity->__get('embed_metadata')
#2 src/addons/LiamW/MentionMiniAvatar/Pub/Controller/MentionMiniAvatarTrait.php(14): LiamW\MentionMiniAvatar\Repository\Mentions->addMentionsToContent(Object(XF\Mvc\Entity\ArrayCollection))
#3 src/addons/LiamW/MentionMiniAvatar/XF/Pub/Controller/Member.php(14): LiamW\MentionMiniAvatar\XF\Pub\Controller\Member->addMentionsToContent(Object(XF\Mvc\Reply\View), 'profilePosts')
#4 src/addons/KL/UserImprovements/Pub/Controller/Member.php(25): LiamW\MentionMiniAvatar\XF\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(249): KL\UserImprovements\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF\\Pub\\Controll...', 'View', 'html', Object(XF\Mvc\ParameterBag), 'members', Object(KL\UserImprovements\Pub\Controller\Member), Object(XF\Mvc\Reply\Reroute))
#7 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
#9 src/XF.php(333): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}


Code:
InvalidArgumentException: Accessed unknown getter 'embed_metadata' on XF:ProfilePostComment[63014] src/XF/Mvc/Entity/Entity.php:182
Generated by:
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('embed_metadata')
#1 src/addons/LiamW/MentionMiniAvatar/Repository/Mentions.php(19): XF\Mvc\Entity\Entity->__get('embed_metadata')
#2 src/addons/LiamW/MentionMiniAvatar/XF/Entity/ProfilePost.php(29): LiamW\MentionMiniAvatar\Repository\Mentions->addMentionsToContent(Array)
#3 src/XF/Repository/ProfilePost.php(145): LiamW\MentionMiniAvatar\XF\Entity\ProfilePost->setLatestComments(Array)
#4 src/XF/Pub/Controller/Member.php(231): XF\Repository\ProfilePost->addCommentsToProfilePosts(Object(XF\Mvc\Entity\ArrayCollection))
#5 src/addons/LiamW/MentionMiniAvatar/XF/Pub/Controller/Member.php(14): XF\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#6 src/addons/KL/UserImprovements/Pub/Controller/Member.php(25): LiamW\MentionMiniAvatar\XF\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(249): KL\UserImprovements\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF\\Pub\\Controll...', 'View', 'html', Object(XF\Mvc\ParameterBag), 'members', Object(KL\UserImprovements\Pub\Controller\Member), Object(XF\Mvc\Reply\Reroute))
#9 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
#11 src/XF.php(333): XF\App->run()
#12 index.php(13): XF::runApp('XF\\Pub\\App')
#13 {main}
 

Liam W

in memoriam 1998-2020
Ah, bottoms. Profile posts and comments only had the embed metadata stuff added in 2.1... I was sorta hoping that it would work without issue in 2.0.

Another version will be coming to tonight, fixing that (I'm just about to leave for Uni).

I would be possible to make a rebuild function that goes through all messages to rebuild tags to include avatars?

Yes, technically. Though that would be exceptionally resource intensive.

Liam
 

Matt C.

Well-known member
Ah, bottoms. Profile posts and comments only had the embed metadata stuff added in 2.1... I was sorta hoping that it would work without issue in 2.0.

Another version will be coming to tonight, fixing that (I'm just about to leave for Uni).



Yes, technically. Though that would be exceptionally resource intensive.

Liam

Well doing it through CLI would be better.
 

Xon

Well-known member
Yes, technically. Though that would be exceptionally resource intensive.
I implemented something like that for User Essentials (which works with more content types even if they don't have embed metadata), and yeah it is horribly painful as you need to re-parse everything and also disable url/media auto-linking or it massively slows everything down.
 

Mian Shahid

Well-known member
Hey @Liam W,
Thanks for the update!

We have a problem when we mention a user in the Profile posts widget or page. Basically it does not do show the avatar, and shows in the ACP the below errors (we got like 12 pages) :
  • Accessed unknown getter 'embed_metadata' on XF:profilePostComment
  • Accessed unknown getter 'embed_metadata' on XF:profilePost
Code:
InvalidArgumentException: Accessed unknown getter 'embed_metadata' on XF:ProfilePost[35783]
src/XF/Mvc/Entity/Entity.php:182
Generated by
Dec 14, 2018
Stack trace

#0 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('embed_metadata')
#1 src/addons/LiamW/MentionMiniAvatar/Repository/Mentions.php(19): XF\Mvc\Entity\Entity->__get('embed_metadata')
#2 src/addons/LiamW/MentionMiniAvatar/Pub/Controller/MentionMiniAvatarTrait.php(14): LiamW\MentionMiniAvatar\Repository\Mentions->addMentionsToContent(Object(XF\Mvc\Entity\ArrayCollection))
#3 src/addons/LiamW/MentionMiniAvatar/XF/Pub/Controller/Member.php(14): LiamW\MentionMiniAvatar\XF\Pub\Controller\Member->addMentionsToContent(Object(XF\Mvc\Reply\View), 'profilePosts')
#4 src/addons/KL/UserImprovements/Pub/Controller/Member.php(25): LiamW\MentionMiniAvatar\XF\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(249): KL\UserImprovements\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF\\Pub\\Controll...', 'View', 'html', Object(XF\Mvc\ParameterBag), 'members', Object(KL\UserImprovements\Pub\Controller\Member), Object(XF\Mvc\Reply\Reroute))
#7 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
#9 src/XF.php(333): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}


Code:
InvalidArgumentException: Accessed unknown getter 'embed_metadata' on XF:ProfilePostComment[63014] src/XF/Mvc/Entity/Entity.php:182
Generated by:
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('embed_metadata')
#1 src/addons/LiamW/MentionMiniAvatar/Repository/Mentions.php(19): XF\Mvc\Entity\Entity->__get('embed_metadata')
#2 src/addons/LiamW/MentionMiniAvatar/XF/Entity/ProfilePost.php(29): LiamW\MentionMiniAvatar\Repository\Mentions->addMentionsToContent(Array)
#3 src/XF/Repository/ProfilePost.php(145): LiamW\MentionMiniAvatar\XF\Entity\ProfilePost->setLatestComments(Array)
#4 src/XF/Pub/Controller/Member.php(231): XF\Repository\ProfilePost->addCommentsToProfilePosts(Object(XF\Mvc\Entity\ArrayCollection))
#5 src/addons/LiamW/MentionMiniAvatar/XF/Pub/Controller/Member.php(14): XF\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#6 src/addons/KL/UserImprovements/Pub/Controller/Member.php(25): LiamW\MentionMiniAvatar\XF\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(249): KL\UserImprovements\Pub\Controller\Member->actionView(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF\\Pub\\Controll...', 'View', 'html', Object(XF\Mvc\ParameterBag), 'members', Object(KL\UserImprovements\Pub\Controller\Member), Object(XF\Mvc\Reply\Reroute))
#9 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
#11 src/XF.php(333): XF\App->run()
#12 index.php(13): XF::runApp('XF\\Pub\\App')
#13 {main}
Any possible solution for this error, this was accrued after upgrade so, can we downgrade this add-on one step?
 

upnet

Active member
We would love to have this feature with 2.1. From what I gather this works different than mini avatar with tags. It will not apply to tags previous to the addon install? We have 4mil posts...Is anyone using this on 2.1 that we can checkout?

I see there was a planned update to this 6 weeks ago. Is it being maintained?
 

deslocotoco

Well-known member
Waiting confirmation to be fully compatible with 2.1.

I don't like to use beta version on my live forum. Creeps me out.
 
Top