Content last modified Tuesday 2 August 2016
hop to #bottom
Categories:
Author:
Current version:
0.3
About It:
Get it:
Rate it:
  • Helpful?
  • 3 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

cbs_gravatar

Description

This is a simple, clean plugin to display gravatars in comment forms. It doesn’t use any cache and provides access to all Gravatar options.

It outputs an <img> tag. If wanted, the image can be linked to the commenter’s website.

Why another gravatar plugin ?

Just because the existing one was too complex for my needs (using a caching library, etc.) and I wanted a straightforward implementation, and also because I wanted the functionality of linking the gravatar image to the commenter’s website if the commenter provided it. It is actually possible to link an image with <txp:comment_web />, but then the link is displayed in all cases, even if the commenter entered no website address. This plugin creates the link only if the commenter entered its website address.

Syntax

In a comment form:

<txp:cbs_gravatar />

Attributes

Required

none.

Optional

  • default: Absolute URL of the default image to display when the commenter has no gravatar. This default image is never resized, so make sure it has the same size as size (see below) for a consistent display. When not specified, Gravatar will return a 1×1 pixel GIF image.
  • size: The square size of the gravatar image, in pixels (numeric value in the range 1 to 80). Gravatar will resize the default 80×80 pixels image to this size, using bicubic resizing. When not specified, it will return the image in its original size of 80×80 pixels.
  • rating: Either ‘G’, ‘PG’, ‘R’ or ‘X’. The commenter’s gravatar will be displayed if it does not exceed the specified rating, otherwise the default image will be shown (see above). By default, all gravatars are shown without restriction.
  • border: Hexadecimal value of the color of a 1px border to be overlaid on the gravatar (example: FF0000). Default is no added border.
  • alt: Alternative text for the image. Default is empty.
  • class: CSS class attribute for the <img> tag, default is no class attribute.
  • link: When set to true, the image will be linked to the commenter’s website (if available). The link will have a “nofollow” attribute if specified in the Textpattern advanced options. Default is false.

Changes history

v0.3 (2008-11-15)

  • Code cleaning, no more warnings.

v0.2 (2006-09-27)

  • Now the plugin sets the “width” and “height” attributes on the XHTML img tag, for a more coherent display during image loading.
  • Code cleaning.

v0.1 (2006-06-28)

Initial release.

Article Request Count:
Initially released:
2006-06-28
Posted here:
27 Jun 2006
Article modified:
20 Apr 2015

Comments/questions? Leave a message in the form.

Commenting is closed for this article.

Commented (4)

gravatar is cool, but site load witch much comments is too slowly :(

Even this website (TXP resources) is using my plugin as you can see here in the comments :)

Would be nice to have this plugin updated to include also functions for fetching gravatar profiles besides the gravatar images.

PS. The comment above is spam.

Colin Taylor:

It would be great to use this, but where does “<txp:cbs_gravatar />” go? I have no idea how to implement this plugin, which is a pity. I am sure I am not the only one
Thanks

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.