Skip to content

mkp-textpattern/mkp_gravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

mkp_gravatar

This tag returns an image tag or an URL with the Gravatar for the email address of the current comment or any given email address.

From the Gravatar Site: An “avatar” is an image that represents you online—a little picture that appears next to your name when you interact with websites. A Gravatar is a Globally Recognized Avatar. You upload it and create your profile just once, and then when you participate in any Gravatar-enabled site, your Gravatar image will automatically follow you there.

Acknowledgements

Previously, there have been two other Gravatar plugins for Textpattern but both are currently in orphan status. I started this one from scratch using PHP Image Requests from the Gravatar Developer Resources as a Guide. I also looked at the code of glx_gravatar for implementation ideas (and the format of this help document).

Links

mkp_gravatar

Just use <txp:mkp_gravatar /> where ever you need a Gravatar to be displayed. If you put this tag into a comment form the Gravatar will be constructed using the email address given by the current comment. If you put this tag anywhere else (where mkp_gravatar has no access to a comment email address) you can supply an email address by the attribute email to create the accompanying Gravatar.

Attributes

secure (default: 0)

  • 1: returns the gravatar using SSL
  • 0: returns the gravatar using non-SSL

email (default: empty/email address of current commentator)

Used inside a comment form the plugin will choose the current commenter’s email address. If you use this tag outside of the comment forms this attribute is needed to give mkp_gravatar the email address to be encoded. Any email can be Gravatar encoded.

size (default: 80)

Defines the size of the resulting Gravatar (range: 1 to 512). All Gravatars are squared.

rating (default: g)

Defines the rating for the Gravatar.

  • g: suitable for display on all websites with any audience type.
  • pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
  • r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
  • x: may contain hardcore sexual imagery or extremely disturbing violence.

default (default: gravatar-logo)

Define which image(s) to display when an email address has no Gravatar. If this attribute is missing gravatar.com’s white G on blue ground will be displayed. If you supply the URLof an image here it will be used. Further it is possible to use gravatar.com’s integration icons based on the submitted email address:

  • 404: do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response
  • mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)
  • identicon: a geometric pattern based on an email hash
  • monsterid: a generated ‘monster’ with different colors, faces, etc
  • wavatar: generated faces with differing features and backgrounds
  • retro: awesome generated, 8-bit arcade-style pixelated faces

force (default: 0)

  • 1: always returns the Gravatar in the form chosen as the default.
  • 0: returns the Gravatar as normal

disable (default: 0)

  • 1: nothing is returned
  • 0: returns the Gravatar as normal

Image and Related Attributes

image (default: 1)

  • 1: returns the image tag of the Gravatar
  • 0: returns the url of the Gravatar

alt (default: empty)

Content of the alt attribute of the image tag.

class (default: empty)

Content of the class attribute of the image tag.

id (default: empty)

Content of the id attribute of the image tag.

style (default: empty)

Content of the style attribute of the image tag.

title (default: empty)

Content of the title attribute of the image tag.

Examples

<txp:mkp_gravatar />;
<txp:mkp_gravatar size="60" default="http://www.example.com/images/gravatar.png" class="gravatar" />;

Used in the form comments it will show the Gravatar of the current commentator

<txp:mkp_gravatar email="[email protected]"; />

Shows the Gravatar for [email protected].

Release History

Version 1.0: September 16th, 2014

Releases

No releases published

Packages

No packages published

Languages