Page 1 of 1

Avatar plugin - suggestions

Posted: Sat Jun 20, 2009 6:35 pm
by Don Chambers
Can avatars be added to trackbacks? Currently, the only way trackbacks can display avatars is if a template uses the $trackback.avatar.

Another request: currently, if the plugin does not specify a default image, and none is found, the <img> code is still emitted and alt text is displayed because no image is found. Any chance of simply displaying nothing if no avatar is found?

Re: Avatar plugin - suggestions

Posted: Sun Jun 21, 2009 1:27 pm
by blog.brockha.us
Don Chambers wrote:Can avatars be added to trackbacks? Currently, the only way trackbacks can display avatars is if a template uses the $trackback.avatar.
At the moment I'm not sure, what results in this. I don't make any difference between comments and trackbacks in the avatar plugin. The Avatar *should* be added, but seems to be overridden later.

I looked into the core code, but didn't find any problem relating this yet.. Have to look deeper, I guess..
Don Chambers wrote:Another request: currently, if the plugin does not specify a default image, and none is found, the <img> code is still emitted and alt text is displayed because no image is found. Any chance of simply displaying nothing if no avatar is found?
Well, the problem here is: At the time the avatar plugin adds the image tag, it doesn't know, if the commenter will get an avatar (or to be more specific: I don't know if he doesn't get an avatar). This is evaluated while loading the src of the img tag.

This is done in order to have avatar evaluation in the background, so gravtar and all these services don't block your blog for each avatar.

Re: Avatar plugin - suggestions

Posted: Sun Jun 21, 2009 1:41 pm
by blog.brockha.us
blog.brockha.us wrote:The Avatar *should* be added, but seems to be overridden later.
Found it. It is the template itself , that strips the avatars from trackbacks:

comments.tpl:
{$comment.body}
trackbacks.tpl
{$trackback.body|@strip_tags|@escape:all}

In the trackbacks.tpl all tags are stripped from the trackback body.. The avatar plugin uses a tag, if not added using smarty. If you change the trackbacks.tpl to

{$trackback.body}

the avatar is shown without smarty option, too.

P.S.: Looking into the core code the @strip_tags directive is useless there, because s9y already stripped all tags found in the original trackback before handing it to the smarty template. Only plugins may add tags in between loading and smartifying.

Re: Avatar plugin - suggestions

Posted: Sun Jun 21, 2009 5:35 pm
by Don Chambers
blog.brockha.us wrote: Found it. It is the template itself , that strips the avatars from trackbacks:
No wonder I was not seeing anything in the plugin code! DOH!

It makes sense that striping tags from trackbacks should not be required by the template - we certainly are not stripping comment body. I only had a moment to check... it appears to be emitting the <img> tag now, but my localhost sandbox pavatar is not being displayed.. not sure if it is a localhost only issue, and will not have time to check a live site until later tonight, or perhaps tomorrow... but I will assume it works. Thanks for looking into this!