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

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>WordPress &#8250; Support Topic: [Plugin: Add Local Avatar] Force a local avatar</title>
<link>http://wordpress.org/support/</link>
<description>WordPress &#8250; Support Topic: [Plugin: Add Local Avatar] Force a local avatar</description>
<language>en</language>
<pubDate>Thu, 26 Nov 2009 01:15:18 +0000</pubDate>

<item>
<title>sargespam on "[Plugin: Add Local Avatar] Force a local avatar"</title>
<link>http://wordpress.org/support/topic/284026#post-1139468</link>
<pubDate>Wed, 15 Jul 2009 20:43:07 +0000</pubDate>
<dc:creator>sargespam</dc:creator>
<guid isPermaLink="false">1139468@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Thanks for the heads up.&#60;br /&#62;
As mentioned, I just code for fun.&#60;br /&#62;
Here is an alternative to modifying the core code of the plugin.&#60;/p&#62;
&#60;p&#62;Do steps 1 and 2 from the original post.&#60;br /&#62;
Instead of step 3, use this code in the your theme's files where get_avatar is used. &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php $user_info = get_userdata($post-&#38;gt;post_author);
$loginname = $user_info-&#38;gt;user_login ;
$DefaultAvatar = &#38;#39;/wp-content/uploads/defaultavatars/&#38;#39;.$loginname.&#38;#39;.png&#38;#39;;
$DefaultAvatarLink = get_bloginfo(&#38;#39;url&#38;#39;).$DefaultAvatar ;
if (!file_exists($_SERVER[&#38;#39;DOCUMENT_ROOT&#38;#39;].$DefaultAvatar)) {$DefaultAvatarLink = &#38;quot;&#38;quot; ;}
echo get_avatar($post-&#38;gt;post_author, &#38;#39;40&#38;#39; , $DefaultAvatarLink); ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Change the 40 in the last line above to whatever you want the avatar size to be.&#60;/p&#62;
&#60;p&#62;The line to be replaced with code above will probably look like &#60;code&#62;&#38;lt;?php echo get_avatar($post-&#38;gt;post_author, &#38;#39;40&#38;#39;); ?&#38;gt;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;The problem is that this will not work in the comments section or with other plugins like &#60;a href=&#34;http://wordpress.org/extend/plugins/author-avatars/&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.org/extend/plugins/author-avatars/&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>peterwsterling on "[Plugin: Add Local Avatar] Force a local avatar"</title>
<link>http://wordpress.org/support/topic/284026#post-1125060</link>
<pubDate>Fri, 03 Jul 2009 18:05:29 +0000</pubDate>
<dc:creator>peterwsterling</dc:creator>
<guid isPermaLink="false">1125060@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Okay understand that.  But what you have done will mess up some of the plug-in's functionality.  For example you have hard-coded &#34;identicon&#34; as the default, if a user copied your code but had set Monster ID as the default they would be confused by the results.  Just wanted to point that out so I don't get lots of queries...&#60;/p&#62;
&#60;p&#62;Maybe you could have uploaded the user details direct to MySQL?  This would have saved the coding and protected you for future updates to the plug-in.  Just a thought.
&#60;/p&#62;</description>
</item>
<item>
<title>sargespam on "[Plugin: Add Local Avatar] Force a local avatar"</title>
<link>http://wordpress.org/support/topic/284026#post-1124074</link>
<pubDate>Thu, 02 Jul 2009 19:29:19 +0000</pubDate>
<dc:creator>sargespam</dc:creator>
<guid isPermaLink="false">1124074@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I have 368 fixed users on the site. The coding was easier than setting one profile at a time.
&#60;/p&#62;</description>
</item>
<item>
<title>peterwsterling on "[Plugin: Add Local Avatar] Force a local avatar"</title>
<link>http://wordpress.org/support/topic/284026#post-1120613</link>
<pubDate>Mon, 29 Jun 2009 19:21:40 +0000</pubDate>
<dc:creator>peterwsterling</dc:creator>
<guid isPermaLink="false">1120613@http://wordpress.org/support/</guid>
<description>&#60;p&#62;You don't need this code for the scenario you describe.&#60;/p&#62;
&#60;p&#62;Save yourself the coding and just set each of your fixed number of users local avatar (on the Users &#38;gt;&#38;gt; Avatars page) to the file you've put &#34;defaultavatars&#34; for that user.  Done.
&#60;/p&#62;</description>
</item>
<item>
<title>sargespam on "[Plugin: Add Local Avatar] Force a local avatar"</title>
<link>http://wordpress.org/support/topic/284026#post-1116781</link>
<pubDate>Thu, 25 Jun 2009 22:06:48 +0000</pubDate>
<dc:creator>sargespam</dc:creator>
<guid isPermaLink="false">1116781@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I have a blog with a fixed number of users and wanted to force avatars for all users even if they did not have a local or global one (using plugin &#60;a href=&#34;http://wordpress.org/extend/plugins/add-local-avatar)&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.org/extend/plugins/add-local-avatar)&#60;/a&#62;. I post the code below for anyone who wants to do the same.&#60;br /&#62;
1. Make a folder defaultavatars in your uploads folder. If you do not follow the default wordpress directory structure, you will have to make appropriate changes to the code.&#60;br /&#62;
2. In the folder created above, upload default avatars for any or all the users using names that follow loginname.png (eg. admin.png, user1.png, ralf.png ...).&#60;br /&#62;
3. copy and paste the following code in avatars.php just before the closing } of if(!$src).&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if($id) {
	$user_info = get_userdata($id);
 	$loginname = $user_info-&#38;gt;user_login ;
	$src2 = &#38;#39;http://www.gravatar.com/avatar/&#38;#39;;
	$src2 .= md5(strtolower($email));
	$src2 .= &#38;#39;?d=identicon&#38;amp;r=any&#38;amp;s=&#38;#39; . $size;
	$headers = wp_get_http_headers($src2);
		// Check the headers
	if (!is_array($headers)) :
		$has_valid_avatar = FALSE;
	elseif (isset($headers[&#38;quot;content-disposition&#38;quot;]) ) :
		$has_valid_avatar = TRUE;
	else :
		$has_valid_avatar = FALSE;
	endif;
     $DefaultAvatar = &#38;#39;wp-content/uploads/defaultavatars/&#38;#39;.$loginname.&#38;#39;.png&#38;#39;;
     if (!$has_valid_avatar &#38;amp;&#38;amp; file_exists($DefaultAvatar)){ $src=&#38;#39;/&#38;#39;.$DefaultAvatar ; }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;FYI- I am not a programmer and the code above may not be the best, but it works for me. I provide it here in the hope it may help someone.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
