Topic: punBB: Gravatar/Wavatar extension

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<extension engine="1.0">
    <title>[W|Gr]avatar Icon</title>
    <description>adds support for gravatar icons with fallback to wavatars</description>
    <author>Michael Hanig</author>

    <hook id="fn_generate_avatar_markup_start"><![CDATA[
        // we need access to the database
        global $forum_db;
    <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="'.md5($email).'?s='.$ava_size.'&amp;d=wavatar&amp;r=PG" width="'.$ava_size.'" height="'.$ava_size.'" alt="" />';


Post's attachments

Attachment icon nan_post_wavatar.7z 788 b, 897 downloads since 2011-02-02 

It is like the number zero… empty, yet holding infinite potential within itself.
- Igor, Persona 4