Skip to content

cjohansen.no

eZGravatar

A single template that enables Gravatars for eZ Publish.

Installation

No point in distributing this as a plugin as that would require more steps to install, than just getting the template and fixing your config.

Copy the template to an active design folder like design/yourdesign/templates and use like so:

{include uri="design:gravatar.tpl"
         email=$node.object.data_map.email
         size=40}

The template requires an md5 template operator. The simplest way to provide such an operator is through template.ini/[PHP]/PHPOperatorList[], ie put the following in an override for template.ini (such as settings/override/template.ini.append):

[PHP]
PHPOperatorList[md5]=md5

gravatar.tpl

Parameters

email

Email address, either as a string or an attribute whose content is an email address.

size

The desired size of the gravatar. Gravatars are square, so this should be a single integer. Default is 80 (pixles).

rating

What content to allow. Any of the following (default is X - ie all):

default

The default image to serve up if email has no gravatar. This may be an URL to an image, or one of identicon, monsterid and wavatar. If the parameter is an empty string the default blue gravatar logo is used as default. Default may also be the string "random" which will choose either one of the defaults.

alt

The alt text for the image. Default is "Gravatar"

class

Optional class name for img tag

id

When using a random default image you may provide any id/number as a way of selecting default image. This way the pick is not actually random since you’ll always get the same gravatar for the same id.

2006 - 2012 Christian Johansen Creative Commons License