Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY000]: General error: 145 Table './skippy_skippy/h_sessions' is marked as crashed and should be repaired in system/classes/databaseconnection.php line 269
I've updated my gravatar plugin to use the new Gravatar REST API. The new API makes it considerably easier for plugins to query the existence of a gravatar, which makes my plugin considerably easier! A few bugs have been squashed, too.
NOTE: this version is called gravatars.php, with an s. If you used a prior version, be sure to deactivate it first, else you'll have function collisions and your blog will break.
Download the gravatars tarball.
Download the gravatars zip.
Feel free to peruse the README.
First and foremost, if you have not yet done so, please fix Bug #902! WordPress versions 1.5.1.1 and above already contain the necessary fix.
Place the gravatars.php file into your wp-content/plugins directory, and activate it. Create the wp-content/gravatars/ directory, if it doesn't exist -- make sure this directory is writable by your web server! Click the Options link in your admin menu, select Gravatars, and set the default options. If you enable local gravatars, click the Users link in your admin menu, select Gravatar, and define a local gravatar image for yourself, if you want one.
Edit your theme's style.css, and add two new definitions:
.gravatar {
float:left;
padding: 3px;
border: 1px solid #000;
background: #fff;
}
.postgrav {
float: left;
padding: 3px;
margin-right: 5px;
margin-left: 5px;
border: 1px solid #000;
background: #fff;
}
note: these are the CSS declarations may not work for you. You may want something different.
Edit your theme's comments.php file, like this. We wrap the entire thing inside an if (function_exists('gravatar')) { block to make sure your site doesn't totally break if you disable this plugin for some reason.
Commenters who have registered for a gravatar will have their gravatar image displayed next to their comments. Anyone who has not yet signed up for an account will receive the gravatar image you defined in your Options page. Registered users who have assigned themselves a local gravatar will automatically have that image assigned.
You can insert a gravatar into any post or page with a simple tag: <gravatar skippy@skippy.net />. If the email address you supply does not have a gravatar, your default gravatar image will be used, instead.
2005-07-02: released version 2.6, adding an ALT attribute to the gravatar images used in posts. Thanks Mike for the heads-up.
2005-07-02: released version 2.5 (skipping 2.4). This version should fix random gravatars
2005-06-20: released version 2.3 (skipping 2.2). This version fixes the &s in the links when used to fetch images from gravatar.com -- thanks Gregory! Also included in this version is support for random default gravatars. Thanks to Shane for the impetus and testing. PLEASE read the updated documentation for details on how to use random gravatars. Also note that I am no longer offering or supporting one-click installs through the WP Plugin Manager.
2005-05-21: released version 2.1. This contains a minor, but important, fix for handling allow_url_fopen. The plugin now uses ini_get instead of get_cfg_var, which should avoid some false positives that had been occuring. Thanks to Fredo for a German translation!
2005-04-21: released version 1.9. Minor fixes for valid XHTML (thanks frozenstar) and local gravatar handling (thanks kiesow). This version also introduces support for localization of the text used in the administrative interface. Included in the archive is /wp-content/gravatars/gravatars.po, which you can use to translate the text as needed. Feel free to send translations to me, and I'll make them available for download.
2005-04-05: released version 1.8. The plugin now checks for the value of the server's allow_url_fopen setting. If disabled, the plugin automatically disables caching gravatars. Updated the caching and looping, to hopefully improve performance. On some servers (like mine!), this plugin can introduce noticable delay. If that bothers you, simply disable caching and all gravatar images will be pulled from gravatar.com. (Note: this plugin is designed to make gravatars more reliable, not necessarily faster!) Updated comments.php template to properly assign gravatars to trackbacks and pingbacks.
2005-04-02: released version 1.6, with special thanks to Adam for fixing a bug with how image sizes are handled.
2005-03-29: released version 1.5, which significantly improves options storage in the database. Also introduces a new cache expiration verification method using the database, instead of the filesystem.
About | Policies | skippy.net
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY000]: General error: 145 Table './skippy_skippy/h_sessions' is marked as crashed and should be repaired in system/classes/databaseconnection.php line 269
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY000]: General error: 145 Table './skippy_skippy/h_sessions' is marked as crashed and should be repaired in system/classes/databaseconnection.php line 269
gravatarclass, as declared in my stylesheet. I'm not a CSS guru, so I relied on Jennifer to properly integrate gravatars into my layout. A quick trick you can use is to put<br clear='all' />right after the call tocomment_text(), like this: <?php comment_text() ?> <br clear='all' />.gravatar { float: right; padding: 3px; margin-right: 5px; margin-left: -50px; margin-bottom: 5px; width: 40px; border: 1px dashed #000; background: #fff; } .postgrav { float: right; padding: 3px; margin-right: 5px; margin-left: 5px; width: 40px; border: 1px dashed #000; background: #fff; }Shows up like this: http://www.mindwiped.com/gurlrider/?p=62 ... perfect heh.comments.php:<?php $foo = get_option('gravatar_options'); $gravatar_size = $foo['gravatar_size']; ?>Then, modify the gravatarimgdeclaration to look something like this:<img src="<?php gravatar('$comment->comment_author_email'); ?>" size="<?php echo $gravatar_size; ?>" />if ($grav_option['gravatar_size'] != '')That should be:if ($grav_options['gravatar_size'] != '')Adam.add_options_page('Gravatars', 'Gravatars', 9, __FILE__, 'gravatar_manage');the __FILE__ make the option pluggin link error 404 on windows xp pro, apache 2, php 5.04. so, i just change it to simple 'gravatars.php' to make it work. same problem with line 25. also one point, could you just define one variable so it makes us easy to change the location of gravatar. right now i have to change allwp-content/gravatarsif i want to put gravatar on different location. once again, thanks.Optionsadmin menu, selectGravatars. The section labelledDefault gravatar imageallows you to specify either a local or remote image to use for all people without a gravatar. For example, anyone with an orange question mark next to their name in the list of comments above does not have a gravatar. The orange question mark is the defualt image I assign, which is located at/images/blank_gravatar.png.<code snipped by skippy>Please help :)php.ini. If your host has disabled this, there is no provision to override it. You can still use my gravatars plugin, but local caching of the images will be disabled.class="postgrav"on them... cheers!gravatars.php, and that is the only one you need to use. Glutnix: thanks for pointing out the errors. The one-click version is currently lagging in updates. I neglected to package a new one-click version for several of the most recent changes. I'll try to remedy that shortly.going to be an open invitation to email spam?imgcode (or the CSS); or manually resize the image file to your preferred dimensions. As for random gravatars for people that have not yet signed up: you can do that using conditional logic in your template. That's not the kind of functionality that belongs in the plugin itself. There's several ways to acomplish this: feel free to email me if you'd like to discuss it. For now, I'll leave it as an exercise to the readers -- post the solution to your own blog and I'll link to it. =) Glutnix: It's actually pretty easy to add seperate gravatar images for pingbacks and trackbacks, and doing so requires no modifications to my plugin. This sort of thing should be done in yourcomments.phptemplate, using conditional logic to check whether the comment is a comment, a pingback or a trackback. If one of the latter two, use whichever image you want. Again, feel free to email me if you'd like to discuss this; and please post your solution on your own blog so that I can link to it! clint: There's no real risk of email harvesting, because gravatar images are keyed off of the MD5 hash of your email address, and not the email address itself.$show_avatar=''; $blank_avatar='/wp-content/gravatars/blank_gravatar.png'; $check_avatar=wp_gravatar($comment->comment_author_email); if ($blank_avatar == $check_avatar) { $show_avatar='/images/avatars/avatar' .rand(1,25) .'.jpg';} else { $show_avatar=$check_avatar;}ANd then, instead of calling the function in the img tag, I did this"And here's a link to see it. http://www.crowspeaker.com/2005/05/01/14/ Scroll down to the bottom comment. Hit reload a few times.WARNING! WARNING! WARNING! allow_url_fopenis DISABLED on this host. Gravatar caching has been disabled.I've no idea what's wrong and what to do :-(Fatal error: Cannot instantiate non-existent class: cachedfilereader in /home/.wadeheater/astralp6/creative-logic.net/wp/wp-includes/wp-l10n.php on line 72issue with my admin menu. I'm running wordpress 1.5.1.2 Line 72 of that particular file is$input = new CachedFileReader($mofile);gravatars.pofile. Have you tried that?style.cssfile, addwidth: 40px;to the.gravatarand.postgravclasses; and (2) In thewp-comments.phpfile, deletewidth='80' height='80'(If you don't do this step, the 80px size will override your width setting in the stylesheet.). If you use option #2 and ever want to change the display size of the gravatars later, you can do it by simply updating thewidth's in yourstyle.cssfile. Mystyle.csscode looks like this:.gravatar { float:left; padding: 1px; margin-right: 5px; margin-left: -50px; margin-bottom: -10px; width: 30px; border: 1px solid #333; background: #fff; } .postgrav { float:left; padding: 1px; margin-right: 5px; margin-left: -50px; margin-bottom: -10px; width: 30px; border: 1px solid #333; background: #fff; }gravatars-en_US.moandgravatars-en_US.pofiles from/wp-contnet/plugins?if ($grav_options['gravatar_size'] != '') $gravatar .= "&size=" . $grav_options['gravatar_size'];to this:if ($grav_options['gravatar_size'] != '') $gravatar .= "&size=" . $grav_options['gravatar_size'];then added a str_replace when its being passed directly to the page:if ('0' == $grav_options['gravatar_cache']) { // we're not using local cache, so give the gravatar.com URL $gravatar = str_replace("&", "&", $gravatar); return $gravatar; }img src="http://macpehemera.gr/wp-content/gravatars/blank_gravatar.png"You have mistype the URI for your default gravatar. Note carefully the domain name.comments.phptemplate file, and use conditional logic to suppress output when no gravatar is present. The functionwp_gravatar_info()accepts as input an md5 sum of an email address, and will return information about the gravatar associated with that email. If no gravatar is defined, it will return a 404 status message. Using this, you ought to be able to do what you want. Mystery Wolf: try something like<div style="clear: both;">after each comment, to avoid the stair-step effect.code...gravatar()function anywhere, as long as you pass it a valid email address:gravatar('skippy@skippy.net');If you want to stick commenters' gravatars in the sidebar, though, you'll likely need to do a lot of CSS jiggery-pokery, all of which is beyond me.elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) )I already have the code to separate them before it.gravatars($comment->comment_author_url);. Also note thatgravatars()accepts a second parameter after the email or URL, which can be used to override the system-wide default. I did this so that you could use a specific gravatar image for all pingbacks and trackbacks, if you want.Warning: is_file(): Stat failed for ...../wp-content/gravatars/95bc3e5fc853264108191bec33081874 (errno=13 - Permission denied) in ...../wp-content/plugins/gravatars.php on line 344This warning appears several times/wp-content/gravatars/directory for all its caching. If you have caching enabled, you need to have this directory available for writing by the webserver. And congratulations! Your's is the 1,000th comment on my blog! =)/wp-content/themes/<your theme>/comments.php and not /wp-comments.php. angel: I've not yet heard from anyone using threaded comments with gravatars; though I know it's possible. You might try asking on the WordPress Support Forum.comments.php, and I'll take a look.//at the beginning of each line./%author%/%year%-%monthnum%-%day%-%post_id%to/permalink/%author%/%year%-%monthnum%-%day%-%post_id%this seemed to help. dunno if it actually did or not. also, my default avatar wasn't showing up because I forgot to add a / to the begining of it. wp-content/gravatars/blank_gravatar.png is different from /wp-content/gravatars/blank_gravatar.pngcan be modified touser_email; ?>. Just place that where you want your gravatar to appear on the posts (in the loop, of course). Then if you have more than one author, it should show the correct gravatar for the current posts author. PHP gurus please correct my code if necessary.comment_author_email()is a WordPress function which displays the author's email address directly to the browser. As such, using it inside thegravatar()function will not work. Do you see gravatars at your blog's Options -> Manage -> Gravatars admin panel? Can you assign yourself a custom gravatar at Users -> Profile?gravatar()code, it returns nothing at all. One thought : my webserver doesn't handle the permalinks. Do you use any of these kinds to get gravatar working ?echo gravatar(str_tolower($comment->comment_author_email));echo gravatar(strtolower($comment->comment_author_email));instead ofecho gravatar(str_tolower($comment->comment_author_email));Thanks again.gravatar()function, so that users don't need to do this! This will give me an excuse to release a new version, which will in turn allow me to close comments on this thread -- 250+ comments is too many!Warning: copy(/home/marisa/public_html/blogg/wp-content/gravatars/07b9b88416bebba9513161e3e837bb85.TMP): failed to open stream: Permission denied in /home/marisa/public_html/blogg/wp-content/plugins/gravatars.php on line 512 Warning: unlink(/home/marisa/public_html/blogg/wp-content/gravatars/07b9b88416bebba9513161e3e837bb85.TMP): Permission denied in /home/marisa/public_html/blogg/wp-content/plugins/gravatars.php on line 515And I get theese error on “Options -> Gravatars”Warning: is_file(): Stat failed for /home/marisa/public_html/blogg/wp-content/gravatars/46d09fc5f86be61959e8f72ef8c31c32 (errno=13 - Permission denied) in /home/marisa/public_html/blogg/wp-content/plugins/gravatars.php on line 344 Warning: is_file(): Stat failed for /home/marisa/public_html/blogg/wp-content/gravatars/b5326cdd5b31156692178eecd479fd3a (errno=13 - Permission denied) in /home/marisa/public_html/blogg/wp-content/plugins/gravatars.php on line 344What can I do about this? Thanks in advance! (Sorry for the double post)echo "comment_type) { echo gravatar($comment->comment_author_email); } elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) { echo gravatar($comment->comment_author_url); } echo "' alt='a gravatar' class='gravatar' />";I hope you can help, thanks.if (function_exists('gravatar'))around all the gravatar calls -- if you ever disable the plugin for any reason, your site will continue to function. Without those calls, your site will break with an error message that it cannot find the function "gravatar". Thomas: CSS and styling are not my strengths. I'm not able to provide any theme or template support.echo "comment_type) { echo gravatar($comment->comment_author_email); } elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) { echo gravatar($comment->comment_author_email); } echo "' alt='' class='gravatar' width='50' height='50' />"; }part, but is doesent work! What do i have to replace? Do i have to write a new function in the gravator.php? THNX for your help ore any further information...gravatar(), and thewp_gravatar()on which it relies, anywhere you want. WordPress'the_author_email()displays the author's email automatically. I think you want to useget_the_author_email(), which will return the email for use with thegravatar()function."; } ?>To implement the Authors Photo on the ?author=1 Page! THNX !!!if (function_exists('gravatar')) { echo ""; }So everybody can see and participate!<gravatar youremail />, obviously supplying your full email address. That should show your gravatar. Since your gravatar works here, there should really be nothing preventing it from working on your site, provided you're using the same email address.http://www.jessicapezak.comwp-content/gravatars/random/rotator.phpIf you place the slash in between the.comand thewp-contentyour rotator seems to work correctly.gravatar()function anywhere you want, as long as you provide it with a valid email address or URI. So, to include your author's gravatars just before you show the_content() in the Loop, you would use something like this:gravatar(get_the_author_email());Styling the gravatar correctly is up to you: I do not provide specific theme or CSS support. As for your second question, yes, your authors can define a local gravatar for themselves. They cannot upload an image through Users-<Gravatars, so they'll need to either point to a remote image somewhere, or transfer their gravatar image to your server in some other way.And it just made the path to my local avatar show up as text, like this: " /wp-content/gravatars/JGS_OutOfPlace.jpg" at the top of the post. I'm not sure how to make it show the image...?echo "<img src='"; echo gravatar(get_the_author_email()); echo " />";get_the_author()function only works in the Loop, so you'll need to place that snippet somewhere inside it. What parse errors were displayed? Do you have a link to the source of the file you're trying to edit?http://fabiodrn.com/wp-content/gravatars/blank_gravatar.pnginstead ofhttp://fabiodrn.com/blog/wp-content/gravatars/blank_gravatar.png