Twavatar

Well this is just totally WONDERFUL. It seems Twitter has removed the function that lets you search for profiles based on email addresses, so this plugin is useless at the moment. I’m trying to come up with some other way to do this. Stay tuned.

This is a simple plugin that, when a visitor leaves a comment, searches the local database then Twitter.com for a profile image associated with the email that the commenter entered. If none is found, the plugin falls through to standard WordPress gravatar behavior. If a twitter.com avatar is found, the address is cached for later use.

Future versions will check the cache age against a time limit and refresh if necessary.

The plugin uses the ‘pluggable’ feature of the WordPress core: certain functions can be redefined and replaced. In this case, I’ve replaced the standard get_avatar() function with one that works a little differently.

Current version: 1.0 stable

Installation: download the .zip file to your computer. Unzip it, and upload the entire twavatar directory to your plugins folder. Activate the plugin from your plugins page. Done.

Please use the link below to download directly from WordPress:

Download or automatically install from the WordPress Plugin Repository

{ 4 trackbacks }

10 nya WordPress Plugin v14-09 | ZtrixQ.se
April 5, 2009 at 1:10 am
Twavatar review, discussions, does it work, and ratings on Loadwp.com | Loadwp.com
August 17, 2011 at 1:43 pm
Twavatar | WordPress Designer
September 16, 2011 at 9:50 pm
Twavatar | Wbcom Designs | WordPress Developer
September 16, 2011 at 9:55 pm

{ 15 comments… read them below or add one }

baron March 26, 2009 at 10:44 am

Works great, thank you

Reply

Patrick March 29, 2009 at 12:18 am

Nice, testing this on this log whats happening.

Reply

Suz March 30, 2009 at 1:08 am

Couldn’t get it to work on my website. I still see the blank gravatar image plus the following text (I guess the error): stdClass Object ( ) before the commentor’s name.

Do I need to edit something (add code) in the theme functions or anything?

Reply

Steve March 30, 2009 at 6:50 am

@Suz – no, you shouldn’t need to add any code. You also shouldn’t be seeing the stdClass Object() notation. Can you send me a URL so I can look at a page where this is happening? You can email it to steve (at) ilikewordpress.com .

Reply

Angela March 30, 2009 at 12:09 pm

I’m seeing the same behavior on my own blog. You can see it in action here:
http://g33kg0dd3ss.com/2009/02/its-all-about-meme/#comments
I’m running WP 2.7.1 on PHP 4.4.7

Steve March 30, 2009 at 1:12 pm

@Angela, thank you for posting the link. Unfortunately, there’s no fix for this at this time, and isn’t likely to be. You should deactivate and remove the plugin.

The issue is that the plugin requires that the web server be running PHP version 5.2 or above. That should have made it into the readme on the plugins page but somehow got omitted. My apologies. The plugin uses functions that aren’t available in earlier versions of PHP and at the moment I have no time to write functions that mimic the ones that aren’t available.

PHP version 4.x is at what they call ‘end-of-life’. In other words, no more updates and no more support for that branch. Most web hosts have upgraded to version 5+ – I encourage you to check your host and see if it’s available on your server. If they are still behind and haven’t upgraded to 5.x, find a new hosting company.

I don’t know about WordPress 2.8, but in the very near future, one of the WordPress requirements will be PHP 5+.

Reply

Angela March 30, 2009 at 2:45 pm

Thanks for the info, Steve…I had a feeling that was the issue. :) My hosting company offers both v4 and v5, but my sites have been hosted on v4 for years and I haven’t bothered changing it yet. Looks like the time to upgrade and resolve any subsequent problems with my sites might be coming sooner rather than later!

Reply

Andrew Gant April 9, 2009 at 9:33 am

Sweeeet!

Reply

sam April 11, 2009 at 5:55 pm

Just curious – can this be modified to work with the WP Twitip ID plugin? That adds a field for the commenter to add their twitter id to the comment.

Reply

Steve April 11, 2009 at 6:00 pm

I’m going to have to do something like that, Sam. With Twitter doing away with the ‘search by email address’ function, there’s not much choice other than to collect twitter usernames. Thankfully, a password won’t be needed.

I just haven’t had the time yet to make the changes. With the changes in the commenting system after v2.7, I’m a little torn as to how much trouble to go to in order to make it backward-compatible to previous versions.

Thanks for the comment!

Reply

sam April 13, 2009 at 3:36 pm

Cool. Well, I’m going to give it a shot. If I come up with some sort of merge/mod of the two plug-ins that works, I’ll let you know.

Steve April 14, 2009 at 6:53 am

@Sam – please do let me know. I just don’t have time to work on it right now.

Reply

Ryan May 4, 2009 at 3:35 am

This is a terric idea. It’s a shame it doesn’t work anymore :(

Reply

Keith Barrett May 27, 2009 at 9:42 pm

It’s not that broken! You just saved me a bunch of work!

All I did was adopt a standard that all my twitter subscribers in the user file will have an email address based on their username (in my case it’s [email protected]). I modified your routine to strip off the @twitter.null just before the twitter.com request so it performs a username lookup instead of an email one. Your entire backend still functions and the entire change to your code was 2 consecutive lines.

HOWEVER I don’t even need your search. I combined this with a TwitterConnect, where the connect automatically creates the user in my user table using this email address standard, and since twitter connect also gives me the image url I can pre-populate your cache and never use your web query.

The end result is that users will be able to log in using twitter, they get their avatars, their profile URL is their twitter profile url, and their display name is “@nnnnn”. I lose having their email address unless they update their their record (but then they’d lose their twavatar to gravatar). (I do have their profile link and a verified identity at that time, so I could always tweet at them).

Thanks

Keith

P.S. Your code is very well written, You even used the wordpress table prefix. I can’t tell you how many plugins I’ve had to “fix” for myself.

Reply

Luis October 28, 2009 at 8:26 pm

in my webblog don´t work

Reply

Cancel reply

Reply to Patrick:

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>