diff -ruN mantisbt-1.2.4/account_prefs_inc.php mantis_patched/account_prefs_inc.php
--- mantisbt-1.2.4/account_prefs_inc.php	2010-12-15 03:26:31.000000000 +0100
+++ mantis_patched/account_prefs_inc.php	2011-02-03 15:54:46.000000000 +0100
@@ -290,6 +290,8 @@
 </tr>
 </table>
 </form>
+
+<?php   include ( 'avatar_file_upload_inc.php' ); ?>
 </div>
 
 <br />
diff -ruN mantisbt-1.2.4/avatar_file_add.php mantis_patched/avatar_file_add.php
--- mantisbt-1.2.4/avatar_file_add.php	1970-01-01 01:00:00.000000000 +0100
+++ mantis_patched/avatar_file_add.php	2011-02-03 15:54:51.000000000 +0100
@@ -0,0 +1,67 @@
+<?php
+# MantisBT - a php based bugtracking system
+
+# MantisBT is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# MantisBT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
+
+   /**
+    * Add the image file to b used as avatar
+    *
+    * @package MantisBT
+    * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+    * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
+    * @link http://www.mantisbt.org
+    */
+    /**
+     * MantisBT Core API's
+     */
+   require_once( 'core.php' );
+
+   require_once( 'file_api.php' );
+
+   $f_avatar_id = gpc_get_int ( 'avatar_id', -1 );
+   $f_file      = gpc_get_file( 'file'     , -1 );
+
+   if ( $f_avatar_id == -1 && $f_file  == -1 ) {
+       # _POST/_FILES does not seem to get populated if you exceed size limit so check if avatar_id is -1
+       trigger_error( ERROR_FILE_TOO_BIG, ERROR );
+   }
+
+   form_security_validate( 'avatar_file_add' );
+
+   if ( !file_is_uploading_enabled() ) {
+       access_denied();
+   }
+
+   access_ensure_global_level( config_get( 'upload_avatar_file_threshold' ) );
+
+   file_add( $f_avatar_id, $f_file, 'avatar' );
+
+   form_security_purge( 'avatar_file_add' );
+
+   # Determine which view page to redirect back to.
+   $t_redirect_url = 'account_prefs_page.php';
+
+   html_page_top( null, $t_redirect_url );
+   
+?>
+<br />
+<div align="center">
+<?php
+   echo lang_get( 'operation_successful' ) . '<br />';
+   print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
+?>
+</div>
+
+<?php
+   html_page_bottom();
diff -ruN mantisbt-1.2.4/avatar_file_delete.php mantis_patched/avatar_file_delete.php
--- mantisbt-1.2.4/avatar_file_delete.php	1970-01-01 01:00:00.000000000 +0100
+++ mantis_patched/avatar_file_delete.php	2011-02-03 15:54:51.000000000 +0100
@@ -0,0 +1,77 @@
+<?php
+# MantisBT - a php based bugtracking system
+
+# MantisBT is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# MantisBT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
+
+   /**
+    * Delete a file from a bug and then view the bug
+    *
+    * @package MantisBT
+    * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+    * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
+    * @link http://www.mantisbt.org
+    */
+    /**
+     * MantisBT Core API's
+     */
+   require_once( 'core.php' );
+
+   require_once( 'file_api.php' );
+
+   /**
+    * Get array of attachments associated with the specified avatar id.  The array will be
+    * sorted in terms of date added (ASC).  The array will include the following fields:
+    * id, title, diskfile, filename, filesize, file_type, date_added. For now one user has
+    * only one avatar which has his avatar_id set equal to user_id.
+    * @param int p_avatar_id integer representing avatar id
+    * @return array array of results or null
+    * @access public
+    * @uses database_api.php
+    * @uses file_api.php
+    */
+   function get_avatar ( $p_avatar_id ) {
+       $c_avatar_id = db_prepare_int( $p_avatar_id );
+   
+       $t_avatar_file_table = db_get_table( 'mantis_avatar_file_table' );
+   
+       $query = "SELECT id, title, diskfile, filename, filesize, file_type, date_added
+                           FROM $t_avatar_file_table
+                           WHERE avatar_id=" . db_param() . "
+                           ORDER BY date_added";
+       $db_result = db_query_bound( $query, Array( $c_avatar_id ) );
+       $num_files = db_num_rows( $db_result );
+   
+       $t_result = array();
+   
+       for( $i = 0;$i < $num_files;$i++ ) {
+           $t_result[] = db_fetch_array( $db_result );
+       }
+   
+       return $t_result;
+   }
+       
+   form_security_validate( 'avatar_file_delete' );
+
+   $f_avatar_id = gpc_get_int( 'avatar_id' );
+   $f_file_id = get_avatar ( $f_avatar_id );
+   
+   access_ensure_global_level( config_get( 'update_avatar_threshold' ) );
+
+   helper_ensure_confirmed( lang_get( 'delete_attachment_sure_msg' ), lang_get( 'delete_attachment_button' ) );
+
+   file_delete( $f_file_id[0]['id'], 'avatar' );
+
+   form_security_purge( 'avatar_file_delete' );
+
+   print_header_redirect( 'account_prefs_page.php' );
diff -ruN mantisbt-1.2.4/avatar_file_upload_inc.php mantis_patched/avatar_file_upload_inc.php
--- mantisbt-1.2.4/avatar_file_upload_inc.php	1970-01-01 01:00:00.000000000 +0100
+++ mantis_patched/avatar_file_upload_inc.php	2011-02-03 15:54:51.000000000 +0100
@@ -0,0 +1,103 @@
+<?php
+# MantisBT - a php based bugtracking system
+
+# MantisBT is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# MantisBT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
+
+   /**
+    * This include file prints out the avatar file upload form
+    * It POSTs to avatar_file_add.php
+    * @package MantisBT
+    * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+    * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
+    * @link http://www.mantisbt.org
+    */
+
+   require_once( 'file_api.php' );
+
+   # check if we can allow the upload... bail out if we can't
+   if ( !file_is_uploading_enabled() ) {
+       return false;
+   }
+
+   $t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
+?>
+<br />
+
+<?php
+   collapse_open( 'upload_form' );
+?>
+<form method="post" enctype="multipart/form-data" action="avatar_file_add.php">
+<?php echo form_security_field( 'avatar_file_add' ) ?>
+<table class="width75" cellspacing="1">
+<tr>
+   <td class="form-title" colspan="2">
+<?php
+       collapse_icon( 'upload_form' );
+       echo lang_get( 'upload_file' ) ?>
+   </td>
+</tr>
+
+<tr class="row-1">
+   <td class="category" width="15%">
+        <?php if ( ON == config_get("show_avatar") ) echo "Current Avatar"; ?>
+   </td>
+   <td width="85%">
+    <table>
+      <tr>
+        <td with="30%">
+        <?php if ( ON  == config_get("show_avatar") ) print_avatar( $p_user_id ); ?>
+        </td>
+        <td with="70%">
+<?php 
+if ( ($p_user_id == auth_get_current_user_id()) || user_is_administrator( $p_user_id ) ) {
+   echo '&#160;[';
+   print_link( 'avatar_file_delete.php?avatar_id=' . $p_user_id . form_security_param( 'avatar_file_delete' ), lang_get( 'delete_link' ), false, 'small' );
+   echo ']';
+}
+?>
+       </td>
+      </tr>
+    </table>
+   </td>
+</tr>
+
+<tr class="row-1">
+   <td class="category" width="15%">
+       <?php echo lang_get( 'select_file' ) ?><br />
+       <?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
+   </td>
+   <td width="85%">
+       <input type="hidden" name="avatar_id" value="<?php echo $p_user_id ?>" />
+       <input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
+       <input name="file" type="file" size="40" />
+       <input type="submit" class="button" value="<?php echo lang_get( 'upload_file_button' ) ?>" />
+   </td>
+</tr>
+</table>
+</form>
+<?php
+   collapse_closed( 'upload_form' );
+?>
+<table class="width75" cellspacing="1">
+<tr>
+   <td class="form-title" colspan="2">
+       <?php
+           collapse_icon( 'upload_form' );
+           echo lang_get( 'upload_file' ) ?>
+   </td>
+</tr>
+</table>
+
+<?php
+   collapse_end( 'upload_form' );
diff -ruN mantisbt-1.2.4/config_defaults_inc.php mantis_patched/config_defaults_inc.php
--- mantisbt-1.2.4/config_defaults_inc.php	2010-12-15 03:26:31.000000000 +0100
+++ mantis_patched/config_defaults_inc.php	2011-02-03 15:54:47.000000000 +0100
@@ -928,7 +928,7 @@
 	 * the updated gravatar images to show on sites
 	 * @global int $g_show_avatar
 	 */
-	$g_show_avatar = OFF;
+	$g_show_avatar = ON;
 
 	/**
 	 * Only users above this threshold will have their avatar shown
@@ -942,6 +942,24 @@
 	 */
 	$g_default_avatar = "%path%images/no_avatar.png";
 
+
+    /**
+     * prefix to be used for the file system names of avatars uploaded to mantis.
+     * Eg: avatar-015-face.png
+     * @global string $g_document_files_prefix
+     */
+    $g_avatar_files_prefix = 'avatar';
+
+    /**
+     * access level needed to upload avatars
+     *  if $g_allow_file_upload set to OFF then avatar upload is disabled
+     * @global int $g_upload_avatar_file_threshold
+     */
+    $g_upload_avatar_file_threshold = DEVELOPER;
+
+
+    $g_update_avatar_threshold  = DEVELOPER;
+
 	/**
 	 * Show release dates on changelog
 	 * @global int $g_show_changelog_dates
@@ -2868,6 +2886,7 @@
 	 * table names
 	 * @global array $g_db_table
 	 */
+    $g_db_table['mantis_avatar_file_table']             = '%db_table_prefix%_avatar_file%db_table_suffix%';
 	$g_db_table['mantis_bug_file_table']				= '%db_table_prefix%_bug_file%db_table_suffix%';
 	$g_db_table['mantis_bug_history_table']				= '%db_table_prefix%_bug_history%db_table_suffix%';
 	$g_db_table['mantis_bug_monitor_table']				= '%db_table_prefix%_bug_monitor%db_table_suffix%';
diff -ruN mantisbt-1.2.4/core/file_api.php mantis_patched/core/file_api.php
--- mantisbt-1.2.4/core/file_api.php	2010-12-15 03:26:31.000000000 +0100
+++ mantis_patched/core/file_api.php	2011-02-03 15:54:46.000000000 +0100
@@ -486,6 +486,8 @@
 	if ( $p_table == 'bug' ) {
 		$t_bug_id = file_get_field( $p_file_id, 'bug_id', $p_table );
 		$t_project_id = bug_get_field( $t_bug_id, 'project_id' );
+    } elseif ( $p_table == 'avatar' ) {
+        $t_project_id = ALL_PROJECTS;
 	} else {
 		$t_project_id = file_get_field( $p_file_id, 'project_id', $p_table );
 	}
@@ -614,7 +616,7 @@
  * @param integer $p_bug_id the bug id
  * @param array $p_file the uploaded file info, as retrieved from gpc_get_file()
  */
-function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null ) {
+function file_add( $p_key_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null ) {
 
 	file_ensure_uploaded( $p_file );
 	$t_file_name = $p_file['name'];
@@ -624,17 +626,36 @@
 		trigger_error( ERROR_FILE_NOT_ALLOWED, ERROR );
 	}
 
-	if( !file_is_name_unique( $t_file_name, $p_bug_id ) ) {
+	if( !file_is_name_unique( $t_file_name, $p_key_id ) ) {
 		trigger_error( ERROR_DUPLICATE_FILE, ERROR );
 	}
 
-	if( 'bug' == $p_table ) {
-		$t_project_id = bug_get_field( $p_bug_id, 'project_id' );
-		$t_bug_id = bug_format_id( $p_bug_id );
-	} else {
-		$t_project_id = helper_get_current_project();
-		$t_bug_id = 0;
-	}
+    # prepare variables for insertion
+    $c_key_id = db_prepare_int( $p_key_id );
+    
+    switch ( $p_table ) {
+        case 'bug':
+            $t_project_id = bug_get_field( $p_key_id, 'project_id' );
+            $c_project_id = db_prepare_int( $t_project_id );
+            $t_key_id     = bug_format_id( $p_key_id );
+            $t_file_hash  = $t_key_id;
+            $c_id         = $c_key_id;
+            break;
+        case 'avatar':
+            $t_project_id = ALL_PROJECTS;
+            $c_project_id = db_prepare_int( $t_project_id );
+            $t_key_id     = bug_format_id( $p_key_id );
+            $t_file_hash  = config_get( 'avatar_files_prefix' ) . '-' . $t_key_id;
+            $c_id         = $c_key_id;
+            break;
+        default:
+            $t_project_id = helper_get_current_project();
+            $c_project_id = db_prepare_int( $t_project_id );
+            $t_file_hash  = config_get( 'document_files_prefix' ) . '-' . $t_project_id;
+            $t_key_id     = 0;
+            $c_id         = $c_project_id;
+            break;
+    }
 
 	if( $p_user_id === null ) {
 		$c_user_id = auth_get_current_user_id();
@@ -643,8 +664,6 @@
 	}
 
 	# prepare variables for insertion
-	$c_bug_id = db_prepare_int( $p_bug_id );
-	$c_project_id = db_prepare_int( $t_project_id );
 	$c_file_type = db_prepare_string( $p_file['type'] );
 	$c_title = db_prepare_string( $p_title );
 	$c_desc = db_prepare_string( $p_desc );
@@ -657,10 +676,9 @@
 			$t_file_path = config_get( 'absolute_path_default_upload_folder' );
 		}
 	}
+
 	$c_file_path = db_prepare_string( $t_file_path );
 	$c_new_file_name = db_prepare_string( $t_file_name );
-
-	$t_file_hash = ( 'bug' == $p_table ) ? $t_bug_id : config_get( 'document_files_prefix' ) . '-' . $t_project_id;
 	$t_unique_name = file_generate_unique_name( $t_file_hash . '-' . $t_file_name, $t_file_path );
 	$t_disk_file_name = $t_file_path . $t_unique_name;
 	$c_unique_name = db_prepare_string( $t_unique_name );
@@ -708,7 +726,6 @@
 	}
 
 	$t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' );
-	$c_id = ( 'bug' == $p_table ) ? $c_bug_id : $c_project_id;
 
 	$query = "INSERT INTO $t_file_table
 						(" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id)
@@ -719,10 +736,10 @@
 	if( 'bug' == $p_table ) {
 
 		# updated the last_updated date
-		$result = bug_update_date( $p_bug_id );
+		$result = bug_update_date( $p_key_id );
 
 		# log new bug
-		history_log_event_special( $p_bug_id, FILE_ADDED, $t_file_name );
+		history_log_event_special( $p_key_id, FILE_ADDED, $t_file_name );
 	}
 }
 
diff -ruN mantisbt-1.2.4/core/print_api.php mantis_patched/core/print_api.php
--- mantisbt-1.2.4/core/print_api.php	2010-12-15 03:26:31.000000000 +0100
+++ mantis_patched/core/print_api.php	2011-02-03 15:54:46.000000000 +0100
@@ -152,7 +152,8 @@
 			$t_avatar_url = htmlspecialchars( $t_avatar[0] );
 			$t_width = $t_avatar[1];
 			$t_height = $t_avatar[2];
-			echo '<a rel="nofollow" href="http://site.gravatar.com"><img class="avatar" src="' . $t_avatar_url . '" alt="User avatar" width="' . $t_width . '" height="' . $t_height . '" /></a>';
+            $t_href = $t_avatar[3];
+            echo '<a rel="nofollow" href="'.$t_href.'"><img class="avatar" src="' . $t_avatar_url . '" alt="User avatar" width="' . $t_width . '" height="' . $t_height . '" /></a>';
 		}
 	}
 }
diff -ruN mantisbt-1.2.4/core/user_api.php mantis_patched/core/user_api.php
--- mantisbt-1.2.4/core/user_api.php	2010-12-15 03:26:31.000000000 +0100
+++ mantis_patched/core/user_api.php	2011-02-03 15:54:46.000000000 +0100
@@ -797,34 +797,50 @@
 * @return array|bool an array( URL, width, height ) or false when the given user has no avatar
 */
 function user_get_avatar( $p_user_id, $p_size = 80 ) {
-	$t_email = utf8_strtolower( user_get_email( $p_user_id ) );
-	if( is_blank( $t_email ) ) {
-		$t_result = false;
-	} else {
-		$t_default_image = config_get( 'default_avatar' );
-		$t_size = $p_size;
-
-		$t_use_ssl = false;
-		if( isset( $_SERVER['HTTPS'] ) && ( utf8_strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
-			$t_use_ssl = true;
-		}
-
-		if( !$t_use_ssl ) {
-			$t_gravatar_domain = 'http://www.gravatar.com/';
-		} else {
-			$t_gravatar_domain = 'https://secure.gravatar.com/';
-		}
-
-		$t_avatar_url = $t_gravatar_domain . 'avatar.php?gravatar_id=' . md5( $t_email ) . '&default=' . urlencode( $t_default_image ) . '&size=' . $t_size . '&rating=G';
-		$t_result = array(
-			$t_avatar_url,
-			$t_size,
-			$t_size,
-		);
-	}
-
-	return $t_result;
-}
+    $c_user_id = db_prepare_int ( $p_user_id );
+    $t_avatar_table = db_get_table ( 'mantis_avatar_file_table' );
+    $query = "SELECT id
+              FROM $t_avatar_table
+              WHERE avatar_id='$c_user_id'";
+    $t_db_result = db_query ( $query );
+    if ( 1 == db_num_rows( $t_db_result )) {
+        $t_found_local_avatar = true;
+        $t_avatar_id = db_result ( $t_db_result );
+        $t_avatar_url = "file_download.php?type=avatar&file_id=".$t_avatar_id."&show_inline=1".form_security_param( 'file_show_inline' );
+        $t_avatar_ref = "manage_user_edit_page.php?user_id=".$p_user_id;
+        $t_size = $p_size;
+        $t_result = array( $t_avatar_url, $t_size, $t_size, $t_avatar_ref );
+    } else {
+        $t_email = utf8_strtolower( user_get_email( $p_user_id ) );
+        if( is_blank( $t_email ) ) {
+            $t_result = false;
+        } else {
+            $t_default_image = config_get( 'default_avatar' );
+            $t_size = $p_size;
+    
+            $t_use_ssl = false;
+            if( isset( $_SERVER['HTTPS'] ) && ( utf8_strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
+                $t_use_ssl = true;
+            }
+    
+            if( !$t_use_ssl ) {
+                $t_gravatar_domain = 'http://www.gravatar.com/';
+            } else {
+                $t_gravatar_domain = 'https://secure.gravatar.com/';
+            }
+    
+            $t_avatar_url = $t_gravatar_domain . 'avatar.php?gravatar_id=' . md5( $t_email ) . '&default=' . urlencode( $t_default_image ) . '&size=' . $t_size . '&rating=G';
+            $t_result = array(
+                $t_avatar_url,
+                $t_size,
+                $t_size,
+                'http://site.gravatar.com'
+            );
+        }
+    }
+    
+    return $t_result;
+ }
 
 # --------------------
 # return the user's access level
diff -ruN mantisbt-1.2.4/file_download.php mantis_patched/file_download.php
--- mantisbt-1.2.4/file_download.php	2010-12-15 03:26:31.000000000 +0100
+++ mantis_patched/file_download.php	2011-02-03 15:54:46.000000000 +0100
@@ -55,51 +55,51 @@
 	$f_file_id = gpc_get_int( 'file_id' );
 	$f_type = gpc_get_string( 'type' );
 
+    // allow only tables we can handle
+    $t_allowed_tables = array ( 'bug', 'doc', 'avatar' );
+    if ( ! in_array ($f_type, $t_allowed_tables) ) {
+        access_denied();
+    }
+
+   // later on either change the table name mantis_project_file_table to
+    // mantis_doc_file_table or change the code on all places with file_download.php
+    // reference to use type='project' instead of type='doc'.
+    if ( $f_type == 'doc' ) {
+        $f_type = 'project';
+    }
+
 	$c_file_id = (integer)$f_file_id;
 
 	# we handle the case where the file is attached to a bug
 	# or attached to a project as a project doc.
 	$query = '';
-	switch ( $f_type ) {
-		case 'bug':
-			$t_bug_file_table = db_get_table( 'mantis_bug_file_table' );
-			$query = "SELECT *
-				FROM $t_bug_file_table
-				WHERE id=" . db_param();
-			break;
-		case 'doc':
-			$t_project_file_table = db_get_table( 'mantis_project_file_table' );
-			$query = "SELECT *
-				FROM $t_project_file_table
-				WHERE id=" . db_param();
-			break;
-		default:
-			access_denied();
-	}
+    $t_file_table = db_get_table( 'mantis_'.$f_type.'_file_table' );
+    $query = "SELECT *
+        FROM $t_file_table
+        WHERE id=" . db_param();
+
 	$result = db_query_bound( $query, Array( $c_file_id ) );
 	$row = db_fetch_array( $result );
 	extract( $row, EXTR_PREFIX_ALL, 'v' );
 
-	if ( $f_type == 'bug' ) {
-		$t_project_id = bug_get_field( $v_bug_id, 'project_id' );
-	} else {
-		$t_project_id = $v_project_id;
-	}
-
 	# Check access rights
 	switch ( $f_type ) {
 		case 'bug':
 			if ( !file_can_download_bug_attachments( $v_bug_id ) ) {
 				access_denied();
 			}
+            $t_project_id = bug_get_field( $v_bug_id, 'project_id' );
 			break;
-		case 'doc':
+        case 'project':
 			# Check if project documentation feature is enabled.
 			if ( OFF == config_get( 'enable_project_documentation' ) ) {
 				access_denied();
 			}
-
 			access_ensure_project_level( config_get( 'view_proj_doc_threshold' ), $v_project_id );
+            $t_project_id = $v_project_id;
+            break;
+        case 'avatar':
+            $t_project_id = $v_avatar_id;
 			break;
 	}
 
