<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<extension engine="1.0">
<id>nan_post_wavatar</id>
<title>[W|Gr]avatar Icon</title>
<version>0.1.1</version>
<description>adds support for gravatar icons with fallback to wavatars</description>
<author>Michael Hanig</author>
<minversion>1.3</minversion>
<maxtestedon>1.3.4</maxtestedon>
<hooks>
<hook id="fn_generate_avatar_markup_start"><![CDATA[
// we need access to the database
global $forum_db;
]]></hook>
<hook id="fn_generate_avatar_markup_end"><![CDATA[
if($avatar_markup == '') {
// no Avatar had been set for this user
// but we only have a user_id (or is there a possibility to access a variable with the email?)
// so let's fetch email address for user_id from the database
$query = array(
'SELECT' => 'email',
'FROM' => 'users',
'WHERE' => 'id='.$user_id
);
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$email = $forum_db->result($result);
// can we get the prefered size of the avatar image from preferences?
$ava_size = 100;
$avatar_markup = '<img src="http://1.gravatar.com/avatar/'.md5($email).'?s='.$ava_size.'&d=wavatar&r=PG" width="'.$ava_size.'" height="'.$ava_size.'" alt="" />';
}
]]></hook>
</hooks>
</extension>
All fields with bold label must be completed before the form is submitted.