Twitter Avatars In Comments WordPress Plugin

Advertisement

Over the last months, Twitter has become extremely popular across the Web, with more blogs, magazines and companies using it to communicate with their audiences and customers. Even we started Twittering a couple of months ago and have over 3,650 followers now. Please feel free to join us and follow Smashing Magazine on Twitter Follow us on Twitter as well.

Although we aren’t sure if Twitter will actually revolutionize blogs (as other blogs claim), Twitter is definitely changing the way website owners communicate with their visitors, and we, designers, need to be aware of that and use appropriate tools to meet the expectations of our clients. Unfortunately, there are not that many plug-ins and extensions for Twitter out there, so we decided to release one: the Twitter Comments WordPress Plug-In.

Twittar WordPress Plugin

The objective was quite simple: create a plug-in that uses Twitter to show avatars in comments in WordPress blogs. But after discovering the potential of the Twitter API, the plug-in evolved into a complete “avatar for comments” solution for WordPress. The plug-in was developed by Ricardo Sousa, a young designer with a strong passion for WordPress and Joomla!.

Twitter Avatars on WordPress Comments Plugin

Features

  • Loads user’s avatar by matching the email address to the user’s Twitter email address.
  • If user doesn’t have a Twitter account, it first tries to load user’s gravatar. If user doesn’t have a gravatar, it loads a default image. This is an optional setting.
  • You can set a 2-pixel border to the images (you choose the color).
  • You can choose the size: we suggest 24, 48 or 72 pixels.
  • You can set an image other than the default one to load if a user doesn’t have a Twitter account or a gravatar.
  • It builds a valid image for you (with alt and title attributes, etc.) based on user details.
  • Allows you to add a class to the image, so you can style it later.

Download the plugin for free

The plug-in is released under the GPL. You can use it for all your projects for free and without any restrictions. Please link to this article if you would like to spread the word. You may modify the plug-in as you wish.

Twitter Avatars on WordPress Comments Plugin

Installation instructions

  1. Copy the “twitter” folder to your plug-in folder (wp_root/wp-content/plugins).
  2. Log in to your WordPress administrator panel, and activate this plug-in (click “Plug-ins” and then “Activate” near the plug-in title).
  3. Now you will need to edit your template’s comments.php file to show the avatar near the user comment.
    1. Click on “Appearance” and then “Editor” in your WordPress back end.
    2. Choose comments.php or comment.php or the PHP file that manages your user comments.
    3. Find the lines where the template manages the comments, and add the following line where you want to show the user’s avatar:
      <?php twittar(size, placeholderimg, border, class, usegravatar, rating); ?>

      Note: You may need to change your template. If your template already supports gravatars in comments, you will need to delete the gravatar tag and add twittar. You may need to make some adjustments in order to show the avatar properly.

      You must change the values inside twittar();. Here’s how:

      size
      The size of the avatar (in pixels). Just insert the number (e.g. 45), without “px.” It is the size for both width and height.

      placeholderimg
      The URL for the image you want to use when the user has neither a Twitter account nor a gravatar. Must be inside quotes (“”). Optional.

      border

      The color for the 2px border. Insert the hexadecimal code of the color (e.g. “#FFFFFF” with the “” marks) but only if you want to use one.

      class
      A CSS class that you want to use to style the avatar. For example: “myimg.” In the CSS, you would include .myimg { }. Put inside “”.

      usegravatar
      Just insert 1 if you want to use gravatars, and 0 if you don’t. If you choose to use gravatars, it will try to load a gravatar image if a Twitter account and picture is not found, otherwise it will load the placeholderimg (default) image directly.

      rating
      Parameter for gravatars only. Read more at www.gravatar.com.

      Note: if you want to skip a parameter and add another in front of it, just replace it with “”.

      Example:

      An example configuration could be:

      <?php twittar("45", "", "", "myimg", 1, "R"); ?>

      Recommended sizes for images: 24, 48 or 72 px.

    4. Save the file and enjoy Twitter avatars (see the image below).

Please feel free to post questions about installation in the comments.

About the author

The plug-in was developed by Ricardo Sousa, a young designer with a strong passion for WordPress and Joomla!. You can follow him on Twitter.

The team here at Smashing Magazine. Mostly Vitaly (vf), Sven (sl) and Iris (il).

  1. 1

    Blogging2U

    January 8th, 2009 5:13 am

    Nice! Never seen anything like this before. Thanks for the plugin. I think plugins is kind of new category for freebies in SM, right?

    0
  2. 2

    Vitaly Friedman & Sven Lennartz

    January 8th, 2009 5:22 am

    @Blogging2U (#1): that’s correct, we are going to try a number of different things in January.

    0
  3. 3

    Lee Munroe

    January 8th, 2009 5:26 am

    Wow, great idea and great job Ricardo! There’s loads of Twitter users that don’t have gravatars so this could be very useful.

    0
  4. 4

    XIII

    January 8th, 2009 5:39 am

    Nice plugin, I still get a lot of comments from people who don’t use Gravatar but do use Twitter.

    0
  5. 5

    Markus

    January 8th, 2009 5:40 am

    Great ideas! Both the Twitter avatars in comments plugin as well as plugins from Smashing Magazine in general.

    0
  6. 6

    Ricardo Sousa

    January 8th, 2009 5:48 am

    Thank you Smashing for publishing this plugin and users for the good comments you have been giving. :)

    0
  7. 7

    Mohsen

    January 8th, 2009 5:58 am

    Thanks for releasing this great plugins. fantastic idea!

    0
  8. 8

    Andre

    January 8th, 2009 6:04 am

    Very nice job! Thanks!

    0
  9. 9

    enzo

    January 8th, 2009 6:13 am

    genius. been waiting for something like this for a while now. love that it’s inclusive of gravatar and doesn’t outright replace it.

    ciao,
    ‘enzo

    http://twitter.com/_enzo

    0
  10. 10

    brtak

    January 8th, 2009 6:17 am

    Nice work, keep smashing :-)

    0
  11. 11

    Jhay

    January 8th, 2009 6:20 am

    Looking good. Thanks SM!

    0
  12. 12

    Chris W.

    January 8th, 2009 6:38 am

    @Vitaly, that is an interesting approach. What happens if Twitter is down, it just finds the gravatar instead?

    0
  13. 13

    Phill Price

    January 8th, 2009 6:38 am

    Great work – this and Tweetbacks will be awesome

    0
  14. 14

    Noam

    January 8th, 2009 6:42 am

    That’s great!
    TNX!

    0
  15. 15

    Bella Casa

    January 8th, 2009 6:42 am

    I wish I were so talented as to actually understand these instructions ;)

    Very cool concept though!

    I do have Gravatar, so I guess I will stick with that for now.

    Bella
    Bella Casa blogs

    0
  16. 16

    Karolis Pocius

    January 8th, 2009 6:49 am

    Sounds nice, but here’s what I get after activating it and placing the code:

    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /public_html/wp-content/plugins/twittar/twittar.php on line 178

    0
  17. 17

    PomCompot

    January 8th, 2009 6:50 am

    Very nice idea to get multiple avatar providers. Icons, fonts, textures, and now plugins, I like this renewal. Smashing is really a valuable resource on the web.

    0
  18. 18

    IC

    January 8th, 2009 6:50 am

    Looks cool. I’m going to give it a try.

    0
  19. 19

    Raphael Camaprdou

    January 8th, 2009 6:52 am

    In the same spirit, @tsaots created a WP plugin that greets you with your Twitter name. More info here.
    Neat concept, that can be developped:
    Why not greet the user via Twitter:
    “Hi Jon, I hope U enjoy reading my site. ++”

    0
  20. 20

    Michiel

    January 8th, 2009 7:07 am

    @Karolis Pocius: yes, you will need to have cURL (libcurl) support in your PHP for this to work. You might try asking your host for this. If you have a dedicated server, installing it should be easy.

    0
  21. 21

    Desire Dupas

    January 8th, 2009 7:14 am

    Seems to work ! Great !!!

    0
  22. 22

    Rene

    January 8th, 2009 7:27 am

    Nice? Does anybody find Twitter not cool? Like me?

    0
  23. 23

    Sal Azad

    January 8th, 2009 7:33 am

    great…. another great stuff from smashing magazine… thanks!

    0
  24. 24

    Merchndise

    January 8th, 2009 7:40 am

    Thanx! Will give it a go.

    0
  25. 25

    Chris Heilmann

    January 8th, 2009 8:20 am

    This is quite nice, but the performance of it is utterly terrible. For each comment you will have two http requests server side and then one client side to load the image. This could perform a lot faster if you do the lot client side (going through a PHP proxy) and delay the display of the image until the page has finished loading. That way you don’t punish users that really don’t care too much about avatars but deliver quickly.

    0
  26. 26

    Marco

    January 8th, 2009 9:33 am

    I agree with Chris that the amount of http requests this results in is unacceptable. I would however build in server-side caching. This will result in the best client side performance and it will also result in less load on the Twitter servers. That way everyone wins.

    0
  27. 27

    Mediumjones

    January 8th, 2009 9:53 am

    Wicked! too bad Smashing isn’t using this plug-in :P

    0
  28. 28

    Ricardo Sousa

    January 8th, 2009 9:59 am

    @Chris Heilmann (#25) & @Marco (#26):

    Yeah. I thought about that too. However i wasnt able to come up with good solutions. I liked yours and will work to implement them :)

    @Chris W. (#12):

    Yes it will load gravatar instead.

    @Bella Casa (#15):

    Thanks. Anything i can help you with about instructions?

    Hope you enjoy it anyways.

    Thanks

    0
  29. 29

    Timothy

    January 8th, 2009 11:35 am

    Anyway this could work by Twitter name and not by email address?

    0
  30. 30

    Chris Wallace

    January 8th, 2009 11:37 am

    How secure is the cURL usage in this plugin? Reason being, it could be a problem for non-techie bloggers that just “want twitter on their blog.”

    0
  31. 31

    Ricardo Sousa

    January 8th, 2009 12:47 pm

    @Chris Wallace (#31):

    Can you explain better what you mean? :)

    Thanks

    0
  32. 32

    Kristen

    January 8th, 2009 4:04 pm

    I just tried to install the plugin on my WordPress blog. Everyone who had a Twitter profile image just showed up as “Image Not Found”. It was trying to pull the images from myblogdirectory/_bigger. Pretty sure that isn’t right. Everyone who had only a Gravatar icon showed up okay. What gives? Do I need to change some code somewhere in order to get things working properly?

    0
  33. 33

    Michael

    January 8th, 2009 4:06 pm

    Love it – will be implementing asap.

    0
  34. 34

    Mitch_Nash

    January 8th, 2009 4:07 pm

    Thanks – appreciate it.

    0
  35. 35

    Ricardo Sousa

    January 8th, 2009 4:13 pm

    Kristen (#33):

    If it is getting the images from your blog it isn’t (but remember that user must input the twitter mail :) ). So if you don’t mind can you share your blog adress so i can check?

    Thanks

    0
  36. 36

    bradyG

    January 8th, 2009 4:40 pm

    Nice plugin. Works like a charm.

    0
  37. 37

    Alex Ch

    January 8th, 2009 6:42 pm

    Brilliant :)

    Thanks
    Alex

    0
  38. 38

    Laura

    January 9th, 2009 12:33 am

    Cool idea. You could potentially extend this to other avatar services, and have an admin menu for specifying an order of preference that the avatars appear in – like some people might prefer gravatars over avatars.

    Think I’ll wait til a later version, based on some of the comments, but awesome work!

    0
  39. 39

    Carlos Guadián

    January 9th, 2009 12:40 am

    Testing…

    0
  40. 40

    Ricardo Sousa

    January 9th, 2009 3:30 am

    @Laura (#39):

    Sure. I will add a couple more of things including the improvments in the global plugin way to do things so it can be more efficient. Thank you for your suggestions.

    Best Regards

    0
  41. 41

    Omair Rais

    January 9th, 2009 3:43 am

    I don’t know why peoples use twitter?…

    Anyways Thanks for sharing.

    Regards
    Omair Rais
    http://www.omairarts.com

    0
  42. 42

    Simon Scullion

    January 9th, 2009 3:57 am

    Love the idea!
    However I am reluctant to have to modify my templates. I’d much prefer something I could configure via the admin panel.
    Would that be possible?

    0
  43. 43

    Simon Scullion

    January 9th, 2009 4:16 am

    Also, could it not use the twitter username rather than an email address?

    Check out http://chinposin.com/ for more twitter avatar madness, you might be able to tie into that somehow too!

    0
  44. 44

    wannesdeloore

    January 9th, 2009 4:20 am

    cool! and nifty.

    0
  45. 45

    Daniel

    January 9th, 2009 4:58 am

    Very nice plugin, and good post. :)

    0
  46. 46

    Youri

    January 9th, 2009 6:32 am

    This is genius because it limits the amount of default avatars in your comments without forcing your user to fill in an extra form field. Excellent release!

    0
  47. 47

    Ricardo Sousa

    January 9th, 2009 7:47 am

    @Simon (#43):

    Sorry but it must be implemented throught Template the way the is right now. I will try to make something sweet that let you add it as a wordpress default avatar system so new wp themes already support without hacks but right now that is the way it works. Anyway you shoulnd’t be worried. Those are not risky hacks.

    Regarding username: It could but for me it doen’t make much sense because you would need a extra input field which is unnecessary. Anyway if you would like it drop me a mail throught http://www.ricardojrsousa.com

    Best Regards

    0
  48. 48

    Kristen

    January 9th, 2009 9:49 am

    @Ricardo (#36)

    Sure thing — here’s an example of an entry w/comments:

    http://kristenbyers.net/blog/?p=2198

    As you can see, people with only gravatars work just fine, Twitter avatars are MIA, and those with neither have the placeholder.

    0
  49. 49

    Baturalp

    January 9th, 2009 12:24 pm

    This plugin looks nice, when I examine the code, however, I realize that it sends a query per comment to the Twitter server. Did you know that Twitter only allows 100 request per hour. So if any post that has 20 comments is visited by 5 people than Twitter will block my web server for that hour period. Therefore this plugin is not usable right now. The plug-in must cache twitter avatars or urls for each email address, probably in database. You need to work on it Ricardo, it is useless now.

    0
  50. 50

    John Faulds

    January 9th, 2009 2:25 pm

    It would be good if the plugin could be modified to cater for both inline and background-images.

    0
  51. 51

    Ricardo Sousa

    January 9th, 2009 3:26 pm

    @Kristen (#49):

    Will try to understand what is the issue and will get back to you.

    @Baturalp (#50):

    Frankly i didn’t knew that but as i said in reply to previous comment i recognize that this is not the most efficient way even it being “a way”.
    I will add cache support to it ASAP.

    @John (#51):
    Is a idea :) Can be worked out. The main idea of the plugin was to be “as simple as possible” but it can be improved to get better performance and more options. I’m working on it ok? :)

    Best Regards

    0
  52. 52

    hoshiyuki

    January 9th, 2009 10:24 pm

    nice!

    0
  53. 53

    Regravity

    January 10th, 2009 6:16 am

    @Ricardo Sousa – Great idea for a plugin, to extend on what Baturalp was talking about it would be good to add in database support so that while twitter is up and accepting links.

    The biggest issue that you will have is that people change their avatars on a regular basis so even if you cache or database the images, you will still have issues with updating each avatar when a twitter user changes it.

    Here is what I propose, because Twitter allows the 100 per hour API request you could initially grab the images for user comments (as requested from page views) as it does now, insert them into the database then set a part of the script to either incrementally grab the commenter images again over midnight (local time to the server wordpress install) in 100 user at a time blocks (this is inefficient) or to have the plugin re-grab the commenter image on next post (which is much more efficient and puts less load on twitter and web server).

    Of course the latter would also need to be described as a limitation due to twitter’s current API allowances.

    The third option to yourself is talk to Twitter…
    Because you aren’t requesting the actual IM text from a tweet and only grabbing the image for a specific twitter user they may work with you to come up with a more viable solution (they have done this in the past).

    All I can say it is an awesome start and good luck in updating it!

    0
  54. 54

    isabela

    January 10th, 2009 7:53 am

    Very nice plugin !

    0
  55. 55

    Baturalp

    January 10th, 2009 8:09 am

    I should include that “cache” does not mean to save a piece of information forever, contrarily it should save information for a limited period of time, like @Regravity said. Because original data might change in time. Therefore you should decide the timeout period for caching, which must not exhaust people’s web server. On the other hand, you should treat nice to twitter’s servers. :)

    Good luck!

    0
  56. 56

    JC Place

    January 10th, 2009 12:34 pm

    Great plugin, thanks alot.

    0
  57. 57

    karl prosser

    January 10th, 2009 1:42 pm

    testing to see if this does work

    0
  58. 58

    micmerty

    January 10th, 2009 9:56 pm

    super dooper … downloading now!

    0
  59. 59

    Aaron Proctor

    January 10th, 2009 10:10 pm

    The showUser() requires an e-mail address, but trackback comments without e-mail addresses pull up someone’s Twitter avatar. Adding a check for this on line 34 fixes the problem.

    0
  60. 60

    aNieto2k

    January 11th, 2009 4:29 am

    If you use the filter ‘get_avatar’ and this code, you dont need to modify your comments.php code.


    function change_get_avatar($avatar, $id_or_email, $size, $defailt, $alt){
    if (function_exists("twittar")) {
    twittar($size, "", "", "myimg", 1, "R");
    return false;
    } else {
    return $avatar;
    }
    }
    add_filters('get_avatar', 'change_get_avatar');

    If you have Twittar plugin active you use the Twitter Avatar and if not active you use get_avatar() function.

    0
  61. 61

    Ricardo Sousa

    January 11th, 2009 9:41 am

    @aNieto2k (#61):

    Thanks. After release that first version i found that and is added on top of version 2.0 that will be released soon with new features and total controll of settings from backend. Anyway this tip is only valid to recent templates. Must of them don’t even use gravatar neither the get_avatar function.
    I will add all the options and change the documentation.

    Thank you very much.

    I will reply to other questions as soon as i get home as i am out right now.

    Thank you all and wait while i talk to twitter regarding the newest versiont that i promisse will be much better.

    Ricardo

    0
  62. 62

    Goyal

    January 11th, 2009 9:52 pm

    Awesome plugin – thanks!!

    0
  63. 63

    Ricardo Sousa

    January 12th, 2009 5:33 am

    @Regravity(#54) & @Baturalp(#56):

    Regarding your informations i’m thankful for them.
    I’m working with twitter (i mailed them) in order to find a solution. Cache will be added (actually it is already added) but the question here is to find an efficient way to make the updates. I’m thinking about create a dummy twitter account. Login will be encrypted and we log on twitter before doing the updates. This account will have (i’m hoping) no limits or better ones.
    So the plugin will load the img adress when the user make the comment and then update in a certain date & time. The big question here is if i can know remotly when the photo is updated. Working on better solutions and willing to hear from you users, as we speak.

    Thanks

    0
  64. 64

    nAODI

    January 13th, 2009 12:32 am

    This sounds cool !

    0
  65. 65

    Denis

    January 13th, 2009 3:16 am

    I have made a litter modification for this plugin to have database support.

    0
  66. 66

    Ricardo Sousa

    January 13th, 2009 5:51 am

    @Denis (#66):

    This will be added in the next version. Would you like o share with me what you did? if so please mail me to blog[at]ricardojrsousa.com just to see if is different from mine.

    0
  67. 67

    Kristen

    January 13th, 2009 4:35 pm

    I still can’t get the plugin to work on my blog, no matter which theme I use. Is it possible that Twittar isn’t compatible with another one of my plugins?

    0
  68. 68

    Conorp

    January 14th, 2009 2:11 am

    Is there anyway this could work oppositely, It try’s to load gravatar first and if it cant it uses twitter?

    0
  69. 69

    Cristian Castellari

    January 14th, 2009 5:19 am

    I’m having a trouble. I set the plugin correctly, but the placeholder image for a users that has not twitter or gravatar is still the gravatar default.

    I want use a custom placeholder image and gravatar too compatibility. The params i use are the followings:

    twittar(48, “http://www.skyflash.it/wp-content/themes/freshnews/images/gravatar.jpg”, “#cccccc”, “gravatar”, 1, “”)

    0
  70. 70

    Ricardo Sousa

    January 14th, 2009 12:15 pm

    @Kristen (#68):
    Excuse me. I’ve been a little busy lately so i completly forgot to get back to you. Are you willing to create an admin (temporary) acccount and send me the details to blog[at]ricardojrsousa.com so i can test in on place and see what is wrong? If so please do it otherwise please post here the exactly code you copied into your comments.php file and confirm that the user for which the default avatar is being given has a twitter account. I can see that there are a user which has the gravatar img so if there are a problem should be with twitter.

    @Conorp (#69):
    I’ve been debating myself with that question. Should i do it or not? Will it be against the initial intent of the plugin? The awnser is yes but i think user should have the option to choose so for the next version this feature will be added. (Totally redisigned params and code). So just way some more days (Check bellow)

    @Cristian (#70):

    May I have your site adress? If you think it’s better plz mail me to blog[at]ricardojrsousa.com with all the info you may be able to provide.

    NEW VERSION:

    Regarding the new version. I’ve been today trying to contact Twitter team so i expect to release the new version within a week. Actually it should be earlier but better give myself a 1 week timeframe. You want more info regarding what exactly it will have improved? Mail me blog[at]ricardojrsousa.com and i will be more than happy to provide you with that info.

    Best Regards,

    Ricardo Sousa

    0
  71. 71

    Cristian Castellari

    January 15th, 2009 1:20 am

    @Ricardo: sure! Mi blog is http://tinyurl.com/7n7h6c
    For better explanation, i left both images:
    the first column is the gravatar built on the blog template. You may see the default icon i’m using and some gravatar users.
    The second column is the twittar plugin. You may see some icons from twitter users AND a gravatar default icon which is not that i declared in the plugin activation code.

    If i use “0″ instead of “1″ in the usegravatar option, the default icon is good, but i lose the gravatar compatibility

    P.S.: may i suggest an “alt” function in the plugin, wich displays a message like “Come see my $twitterprofile and follow me!” when the mouse hovers the icon?

    0
  72. 72

    WP Cult

    January 15th, 2009 11:13 am

    That is really awesome, I really like this idea!

    0
  73. 73

    Cristian

    January 15th, 2009 1:41 pm

    Solved! Was a my mistake! I’ve forgot the ” ” for the size parameter.

    0
  74. 74

    Ricardo Sousa

    January 16th, 2009 6:49 am

    @Cristian (#74):

    Sorry for delay. Glad you solved!

    All other issues:

    i will be out for the weekend but will get back to them ASAP.

    Ricardo

    0
  75. 75

    Kristen

    January 16th, 2009 10:42 am

    @Ricardo (#71): Just figured out the problem this morning! I finally figured out how to upgrade my host to PHP 5.0 and it solved a few minor problems I was having. Might be useful information for troubleshooting other users in the future.

    The plugin is working great now, thank you!

    0
  76. 76

    DoctorFu

    January 17th, 2009 7:36 pm

    So is there a future update coming out to use “alt”?

    0
  77. 77

    Ricardo Sousa

    January 19th, 2009 6:12 am

    @DoctorFu:

    Hope to have one till the end of the week.

    Cheers

    0
  78. 78

    Rogov Dmitry

    January 23rd, 2009 5:00 am

    Nice, tnx

    0
  79. 79

    borism

    January 25th, 2009 9:23 am

    Thank you very much for this interesting Plug-In. I think, I`ll try it out.
    Greetings
    Boris

    0
  80. 80

    Nicolas TAFFOREAU

    January 26th, 2009 3:04 pm

    Nice plugin, thank’s ! But i’m using Gravatar.

    0
  81. 81

    Nneon

    January 28th, 2009 5:08 pm

    I’ve installed the plugin but am unable to get the twitter avatars to show up…

    The default and gravatar images work… the twitter ones do not.

    I’ve tested this by changing my email address on one of the comments to match my email address used on twitter.

    I’m also using php5

    Any ideas on what could be wrong?

    0
  82. 82

    Dave

    February 1st, 2009 10:16 am

    Does this also give the user the option to send a tweet with the comment at the same time – nice plugin

    0
  83. 83

    disklayekly

    February 10th, 2009 7:38 pm

    fascinating and informative, but would make something more on this topic?

    0
  84. 84

    Joe Brooks

    February 17th, 2009 10:48 am

    Is this compatible with WordPress 2.7?

    I only have 50)); ?> in my comments.php that refers to avatars.

    Please make it compatible with WordPress 2.7 :)

    0
  85. 85

    Jesse Friedman

    February 27th, 2009 6:04 am

    This plugin is great. It was working under WP 2.7 but no longer works under WP 2.7.1 Any intentions on updating it?

    0
  86. 86

    Suz

    March 1st, 2009 8:12 pm

    I was wondering how this plugin might work with themes that use the wp_list_comments() function instead of legacy comments. I can’t figure out what to edit in order to insert the Twittar code.

    0
  87. 87

    Jorin Cowley

    March 5th, 2009 2:46 am

    Are you using this plugin?

    0
  88. 88

    Michael SteelWolf

    March 5th, 2009 5:40 am

    Same question as Suz above.

    0
  89. 89

    Tom Graham

    March 6th, 2009 6:35 am

    Cool

    0
  90. 90

    Masey

    March 7th, 2009 9:57 pm

    I can’t see how to make this plugin work using WordPress 2.7.1.

    The only lines of code I can find for comment templates in my theme’s comments.php file are as follows:


    php wp_list_comments('avatar_size=60&type=comment');

    I can’t do anything with that????

    The only place I have found to actually alter the layout/styling of the comments is in the wp-includes/comment-template.php file. If I add the Twittar code to that page it doesn’t work, presumably because it is outside my theme folder, and breaks the Blog code.

    Surely someone else has run into this problem?

    If it helps, I’m using the “Gazette” Woo Themes” theme.

    Any help would be greatly appreciated.

    0
  91. 91

    Travis

    March 31st, 2009 9:57 am

    Is this plugin still being developed?

    0
  92. 92

    Terrance Charles

    April 2nd, 2009 10:50 am

    Perfect, hell of a great post, I needed this. Going to add it to my blog now ;-)

    Terrance Charles

    0
  93. 93

    Paul Pichugin

    April 2nd, 2009 9:08 pm

    Looks like a great plugin, I’ll be using it on my site soon :-)

    0
  94. 94

    yugom

    April 3rd, 2009 3:33 am

    thanks…

    0
  95. 95

    joe

    April 5th, 2009 8:57 pm

    yeah!

    0
  96. 96

    Jason

    April 9th, 2009 9:22 am

    I don’t think this works anymore. Is there an alternative?

    The email parameter has been deprecated
    /users/show/show.xml?email=xxx@xxxxxx.com

    0
  97. 97

    John

    April 17th, 2009 9:01 am

    I really like this idea, but can’t get it work on my site with wordpress 2.7.1. Any plans for an update?

    0
  98. 98

    Montana Flynn

    April 19th, 2009 3:30 pm

    How about a register to your wordpress blog plugin? Throw in a checkbox says “log in from twitter” click opens up a button says connect from twitter. You click, it opens oauth, you accept. Your registered. Now your comments show up with your avatar and you can retweet from the comments form.

    0
  99. 99

    Jagadish

    April 21st, 2009 4:36 pm

    Great idea. Have to see it working to say more.

    0
  100. 100

    Gert Hough

    April 28th, 2009 11:16 am

    Haha – I just needed to add a comment on this post as I think it would be great running it on my blogs. If I can get it to work :-) And off course for the fun seeing it in action. Great idea Ricardo – and thanks for having worked at it.

    0
  101. 101

    Super Gab

    May 3rd, 2009 6:44 pm

    Hi, I just can’t make it work. It gets the gravatar image but not the Twitter image.

    0
  102. 102

    Pinto

    May 8th, 2009 11:28 am

    Hi,
    Great plugin but i have some error with it.
    after installing the plug in i have add the code line but got this error:

    Parse error: syntax error, unexpected T_CLASS in /wp-content/themes/Digital-Statement/comments.php on line 26

    and line 26 is thae line the you have told to add here.
    Please help.
    Thanks

    0
  103. 103

    Chris

    May 11th, 2009 1:31 pm

    This could be an interesting addition to the blog. I’ll check it out some more. Does it slow down the blog page load at all?

    0
  104. 104

    Chris

    May 11th, 2009 1:32 pm

    It didn’t work for me. It should grab my twitter icon based on email address, right?

    0
  105. 105

    ervin

    May 13th, 2009 12:35 am

    Fantastic…gonna try it

    0
  106. 106

    Dan Y

    May 14th, 2009 2:58 am

    Forgive me for wasting your time but I am eager to get this plugin working and can’t manage it. I think I need to be walked through these two tasks:

    1) Exactly where to insert line in comments.php
    2) How/where to find/delete gravatar tag.

    Sorry to be such a bother and dummy. But the help would be greatly appreciated.

    Best,
    Dan

    Best,
    Dan

    0
  107. 107

    Tolga

    May 15th, 2009 8:37 am

    thank you, that is exactly what i was looking for

    0
  108. 108

    Boloo

    May 21st, 2009 11:49 pm

    Thanks a lot, i´m trying it i my blog :P

    0
  109. 109

    Luc

    May 29th, 2009 1:29 pm

    Is it magic ?

    0
  110. 110

    Kay

    June 5th, 2009 7:19 am

    Any plans on updating the plugin? It would be awesome.

    0
  111. 111

    yinin

    June 17th, 2009 6:15 pm

    我试验一下

    0
  112. 112

    tasarhane

    June 21st, 2009 9:36 am

    its pretty useful.. thanks

    0
  113. 113

    Valk de Joost

    June 27th, 2009 12:43 pm

    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/user/public_html/wp-content/plugins/twittar/twittar.php on line 178

    And you haven’t bothered to update the plugin since January, despite promises to the contrary.

    FAIL.

    0
  114. 114

    eliezer

    July 8th, 2009 12:23 pm

    it sucks that * I * can’t find where to insert:

    ):

    I installed a theme called modularity and I can’t find the comments template. Shit.

    Any ideas?

    0
  115. 115

    eliezer

    July 8th, 2009 12:27 pm

    YEAH! I’ve found it buut now my Twitter avatar is not being displayed. ¬¬

    0
  116. 116

    eliezer

    July 8th, 2009 12:31 pm

    as a matter of fact no twitter avatars are being shown. : O

    I copied the folder via FTP to the plugins folder, I activated the plugin through the wp-admin, and then I changed this line in comments.php:

    twittar(“75″, “”, “”, “avatar avatar-75 photo”, 1, “R”); //echo get_avatar( $comment, 75 );

    Help? This plugin seems to rock. What do the users have to put? The twitter registration email address or something?

    0
  117. 117

    eliezer

    July 8th, 2009 12:46 pm

    It’s working because if I set the “usegravatar” parameter to (int)0 I don’t see a friend’s avatar, but if i set it to true boolean way I do see her gravatar, but it’s not her Twitter avatar.

    I used my email in a comment but my Twitter avatar is not displayed.

    0
  118. 118

    eliezer

    July 8th, 2009 12:50 pm

    If i do the XML request directly from my browser to Twitter I get:

    /users/show/show.xml?email=john@twitter.com
    The email parameter has been deprecated

    Isn’t Twitter accepting email as parametters anymore?

    0
  119. 119

    eliezer

    July 8th, 2009 12:57 pm

    I just realized your plugin is not going to work as long as Twitter doesn’t want to take that parameter.

    USELESS. sorry to say that.

    0
  120. 120

    eliezer

    July 8th, 2009 1:00 pm

    dude, let’s try to do it some other way, I’ve found this information for you:

    http://code.google.com/p/twitter-api/issues/detail?id=411

    Key is here now:

    http://twitter.com/users/username.xml

    0
  121. 121

    eliezer

    July 8th, 2009 1:08 pm

    You know, I could just change your plugin name and keep all the credit, but here’s your fix bro!

    Find in wp-content/plugins/twittar/twittar.php and change this:

    function showUser($id){
    // Will arrange the url we need to open @ twitter to get the photo info
    $request = 'http://twitter.com/users/show/show.xml?email='.urlencode($id).'';
    // Will open another function that will do all the hard work :)
    return process($request);
    }

    for this:

    function showUser($id){
    $id = explode('@', $id);
    $id = $id[0];
    // Will arrange the url we need to open @ twitter to get the photo info
    $request = 'http://twitter.com/users/'.strval($id).'.xml';
    // Will open another function that will do all the hard work :)
    return process($request);
    }

    Links or credits are welcomed. ( :

    Now, we can specify in a Label something like..

    Email (to use Twitter enter youryoursername @twitter.com)

    And then everything will match.

    0
  122. 122

    eliezer

    July 8th, 2009 9:38 pm

    dude, lol…

    you’re not gonna show my contribution to your script???

    it didn’t work until I showed you how, you know? Be FAIR.

    0
  123. 123

    ruud

    July 12th, 2009 10:53 am

    Hi,

    Tried this above but the Twavatar plugin works easier.

    0
  124. 124

    matt

    July 13th, 2009 9:52 pm

    I was wondering if anyone has tried Twittar on the Magazeen theme that Smashing released recently. I can’t seem to get this to work. I am sure it has something to do with the magazeen_comments function, but I have no idea what. Thanks for the help!

    0
  125. 125

    john

    July 23rd, 2009 6:20 am

    Has this been setup on the smashingmag blog? I’ve just posted my comment here using my twitter email. fingers crossed

    it didn’t work :(

    0
  126. 126

    Ricardo Sousa

    July 23rd, 2009 12:02 pm

    Hello,

    I’m sorry for so long-time with no replies for you all.
    I’ve been dealing with some personal issues that come into the way and drove me away from development work.
    I’m now quite “Back to Work” and I’m ready to present the version 2 of this plugin which will not only fix tons of the issues reported but also present a more efficient way to get the avatars. This version is already ready but need some testing and fixing prior to release.

    I’m going off for a week or so to enjoy some (deserved) vacations. Then I will be releasing 2.0 version of Twittar ;) The fix eliezer presented should work just fine in the meanwhile.

    ————————————————
    READ THIS:

    Now the important part:
    Whoever mail me at: blog@ricardojrsousa.com within next week will be not only the first to receive Twittar2 but will also get free install of the plugin. Yes, I’m installing twittar in each one of your websites on your request.
    If you do not wish the install but just the plugin you can tell me that on the mail…

    As soon as i get back I will start those installations as my primary to-do.

    Twittar2 will be released in this page for everyone else in the 5 days following the 1st hand release for those who mail me.

    ————————————————-

    Some new about Twittar2:
    - Now include backend;
    - No need to edit que comment.php file anymore;
    - Stores avatars for better managing;
    - Options to refresh avatars ;)
    - Many more settings;
    - Linking to twitter when click the avatar will be possible;
    - and more…

    Thanks!

    I hope you can forgive me ;)

    Ricardo

    0
  127. 127

    Eric Martin

    July 24th, 2009 8:18 am

    Great idea – too bad it doesn’t work!

    The email parameter has been deprecated: Test for yourself

    It will only work if you can capture the user’s twitter username/id/screenname in addition to their email.

    0
  128. 128

    NovRain

    July 30th, 2009 9:07 am

    YEAH! I’ve found it buut now my Twitter avatar is not being displayed. ¬¬

    0
  129. 129

    Andres

    August 3rd, 2009 2:03 pm

    What if I have both Gravatar and Twitter?

    (EDIT-> shows Gravatar)

    0
  130. 130

    josh

    August 6th, 2009 7:49 pm

    will you be able to get this to work again?

    0
  131. 131

    André Câmara

    August 10th, 2009 3:22 pm

    test

    0
  132. 132

    Boloo

    August 24th, 2009 4:20 am

    I think this is not working

    0
  133. 133

    wartoon

    August 26th, 2009 7:27 am

    What does this use?

    0
  134. 134

    tamilsweet

    September 9th, 2009 12:24 am

    Thanks!!!

    0
  135. 135

    Thomas McGregor

    September 24th, 2009 4:38 am

    Hey,

    I have actually just created a WordPress plugin that does exactly what’s described above, but circumvents the problems with the above plugin since Twitter changed their stance on allowing to search by email address.

    You can find it here http://wordpress.org/extend/plugins/twitter-avatar

    Let me know what you think, cheers,

    Thomas

    0
  136. 136

    Abel Braaksma

    October 2nd, 2009 11:42 am

    If I understand you well, this plugin shows the Twitter image when you have both an Avatar and a Twitter icon. I figured you would use this yourself on this blog, why don’t you? At least it seems that you don’t use it here (no links, no mouseovers with info). EDIT>>> Avatar icon is used on this site instead of Twitter, but not sure its the same plugin here

    Hint: there are also plugins that can take @yourname and auto-turn it into a Twitter.com/yourname link, as with @Kandura (my twitter name).

    I like this plugin, thanks!

    0
  137. 137

    Robson Niedson

    October 7th, 2009 7:03 am

    muito legal isso! verry good! where are my pic of twitter here?

    0
  138. 138

    WelcomeToTheSky

    October 8th, 2009 6:50 am

    Great, I get it :)

    0
  139. 139

    jerome robins

    October 14th, 2009 3:24 pm

    testing

    0
  140. 140

    jerome robins

    October 14th, 2009 5:14 pm

    i cant get this thing to work….i have to put it on my functions.php page instead…is this right?

    plus when i did it, it didnt work :(

    0
    • 141

      Gemma Wild

      December 29th, 2009 2:50 pm

      Hi Jerome

      Ignore the instructions found in the following article: http://wp.smashingmagazine.com/2009/03/04/15-useful-twitter-plugins-and-hacks-for-wordpress/ (I’m assuming this is where you got your info to copy all the code from twittar.php file to your themes functions.php file as I did the same and it does not work).

      Just activate the plugin in the normal way and add the given php code to your comments.php file (as stated in the readme.txt file that comes with the plugin) then you will find it works perfectly.

      0
  141. 142

    Gina

    October 16th, 2009 5:48 am

    Testing to see how it all turns out .

    0
  142. 143

    singh

    October 19th, 2009 7:55 am

    lets see

    0
  143. 144

    Jimmy Liew

    November 12th, 2009 9:12 am

    That is great! It really helpful

    0
  144. 145

    BLOGBloke

    November 16th, 2009 3:01 am

    Is there any way to make it work with the WordPress Thread Comment plugin? The avatar doesn’t show up in the reply thread.

    ..BLOGBloke

    0
  145. 146

    offsetik

    November 30th, 2009 1:02 am

    Очень нравится.

    0
  146. 147

    Gemma Wild

    December 29th, 2009 2:16 pm

    Has anyone else reported that this ‘hack’ appears to conflict with ALL other plugins installed on their blog? I received the following error once I added the code to my functions.php file:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/—-/public_html/wp-content/themes/—-/functions.php:7) in /home/—-/public_html/wp-content/plugins/*pluginname*/*pluginname*.php on line 1966

    I tried de-activating plugins to see if it was specific ones but the same error was always present, just with the next plugin instead.

    This looks like a great plugin so any ideas what the problem is and how it can be resolved?

    Thanks! Gemma

    0
  147. 148

    Mattias

    January 3rd, 2010 3:00 am

    Sadly, it doesn´t work. Tried Elizers workaround with WP2.9 and it´s a no go. It sure picks upp a twitter avatar, but it isnt the right one.

    When I look in the author profile for that comment I get the correct url to the avatar, but somebody elses is used in the comments field.

    This is what is picked up in the comments: http://a1.twimg.com/profile_images/19932962/Photo_5_normal.jpg and this is the url in the author profile for that comment: http://a3.twimg.com/profile_images/560114545/parkering-forbjuden_bigger.jpg (the one it should be)

    Ricardo seems to be on a long vacation, since there hasn´t been any updates yet.

    0
  148. 149

    Athena

    January 3rd, 2010 7:10 pm

    An update for WP2.9 would be great. Otherwise, this is dead in the water :(

    0
  149. 150

    Violet

    January 5th, 2010 10:22 am

    I’ve come across a small handful of blogs that use something similar, only it allows you to sign in using either A) Gravatar B) Twitter C) Facebook or D) OpenID (I think)

    And I can not for the life of me remember which blog it was I used it last on… I’d like to find this so that I can use it as well.

    Any ideas???

    0
  150. 151

    Usdating

    January 10th, 2010 2:30 pm

    Very very usefull info. I think this is a ‘TOP1 Article into Build Link Popularity. Keep going!

    0
  151. 152

    ejaz

    January 14th, 2010 6:07 am

    testing testing

    0
  152. 153

    ejaz

    January 14th, 2010 6:38 am

    ?????

    0
  153. 154

    Jamie Bicknell

    January 28th, 2010 5:41 am

    This doesn’t work due to changes in the Twitter API.

    The script tries to find Twitter account information via:
    http://twitter.com/users/show/show.xml?email=email@address.com

    However, Twitter have stopped allowing searches based on the email address, so therefore this sadly can no longer be done. You can however use the following URL to grab the Twitter avatar based on the screen name, but you will need to ask for this information from the user in the comment form. See this URL:
    http://twitter.com/users/show/show.xml?screen_name=jamiebicknell

    0
  154. 155

    Antonio Bustamante

    February 7th, 2010 7:11 am

    Jamie is totally right, the parameter ‘email’ was deprecated in the Twitter API, and there is no practical way to do it. You could try to perform a ‘search’ according to the nickname of the visitor, but that requires authentication. It’s a shame, but I guess spammers found a way to take advantage of that feature.

    My suggestion is that Smashing Magazine should modify the plugin for it to work at least with Gravatar (but you don’t need a plugin for that)… so maybe a small warning message to the visitors regarding this situation?

    0
  155. 156

    Best WP Plugins

    February 22nd, 2010 2:03 pm

    Can you provide more information on other wordpress plugins, or do you have some resources you can share with us where we can find such useful stuff? Thanks.

    0
  156. 157

    engns

    March 12th, 2010 11:31 am

    thank youuuu saolun

    0
  157. 158

    wesley

    April 27th, 2010 5:36 pm

    thanks!

    0
  158. 159

    x0o

    June 23rd, 2010 3:03 pm

    thankyouuu

    0
  159. 160

    kase

    June 24th, 2010 12:40 pm

    works?

    0
  160. 161

    Bruno

    July 4th, 2010 1:50 pm

    Nem funciona :/ Don’t works

    0
  161. 162

    LinkinnShadow

    July 6th, 2010 6:59 am

    Does Smashing Magazine use this method?

    0
  162. 163

    Renato Andrade

    July 7th, 2010 10:07 am

    testing

    0
  163. 164

    BBBllllaaahhh

    August 8th, 2010 2:03 pm

    Holy shit, can somebody update this post saying this plugin does NOT work anymore? before anyone else, like me, wastes an hour trying to get it to work, only to find out the hard way…

    0
  164. 165

    Carl Thress

    August 11th, 2010 7:57 am

    Looks like Twitter deprecated the email parameter in its API call, so the showUser($id) function no longer works. Too bad, really, because this looked like a pretty cool plugin.

    0
  165. 166

    Resim Paylas

    September 20th, 2010 11:57 pm

    I like to post this comment .It helps a lot.The one thing I do know for sure, if that day comes, is that when it’s wedding cake cutting time, I will NOT make the same mistake I witness at every wedding. I will not be serving Champagne with dessert, but rather the slightly sweet and fizzy dessert wine,..

    Thanks and Regards

    0
  166. 167

    M2

    September 21st, 2010 12:36 am

    Fine-sharing have been, thank you…

    0
  167. 168

    Ygor Teixeira

    September 30th, 2010 6:04 am

    Im going make a test. :)

    0
  168. 169

    Ygor Teixeira

    September 30th, 2010 6:05 am

    Failed

    0
  169. 170

    Gustavo Guichard

    November 6th, 2010 5:24 pm

    It’s not working :/… The Twitter API has been updated!

    0
  170. 171

    Tim

    December 14th, 2010 2:19 am

    Hey Ricardo,

    Hope this works nicely with WP 3.x. Gravatars and Twitcons. Nice.

    Rats….Jamie Bicknell and other report that changes at Twitter will make this not work nicely. What a shame.

    Cheers,
    Tim

    0
  171. 172

    Lee

    May 21st, 2011 2:24 pm

    Hi great plugin thanks!

    0
  172. 173

    Skywalk

    August 1st, 2011 11:05 pm

    Testing

    0
  173. 174

    orlandotm

    August 11th, 2011 2:00 am

    prova

    0
  174. 175

    jairo

    September 5th, 2011 2:35 pm

    :D

    0
  175. 176

    teo

    September 30th, 2011 5:16 pm

    Testing

    0
  176. 177

    turbo_MaCk

    November 17th, 2011 4:29 pm

    Does this works with WAMP? I don’t know why but on my ‘local’ I have everyone ‘without twitter like ‘ – with default avatar:-(
    P.S. php_curl works

    P.S. Twitter api change!!!!!!!!!!!!!!

    0
  177. 178

    dave

    January 30th, 2012 4:05 am

    i don’t get it:
    comments are displayed with the wordpress command
    how am i meant to ‘Find the lines where the template manages the comments, and add the following line where you want to show the user’s avatar’?

    0

Leave a Comment

Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!

↑ Back to top