Smashing Magazine - we smash you with the information that will make your life easier. really.

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 Twitter in Twitter Avatars In Comments Wordpress Plugin 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.

[Offtopic: by the way, do you know the Smashing Network has its own Smashing Network RSS Feed? Only excerpts are displayed in the feed.]

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!.

Release in Twitter Avatars In Comments Wordpress 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.

Preview in Twitter Avatars In Comments Wordpress 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 Sven & Vitaly.

Post Rating
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 3.50 out of 5)
Loading ... Loading ...

Tags: , ,

Advertising
  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?

  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.

  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.

  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.

  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.

  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. :)

  7. 7
    Mohsen
    January 8th, 2009 5:58 am

    Thanks for releasing this great plugins. fantastic idea!

  8. 8
    Andre
    January 8th, 2009 6:04 am

    Very nice job! Thanks!

  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

  10. 10
    brtak
    January 8th, 2009 6:17 am

    Nice work, keep smashing :-)

  11. 11
    Jhay
    January 8th, 2009 6:20 am

    Looking good. Thanks SM!

  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?

  13. 13
    Phill Price
    January 8th, 2009 6:38 am

    Great work – this and Tweetbacks will be awesome

  14. 14
    Noam
    January 8th, 2009 6:42 am

    That’s great!
    TNX!

  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

  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

  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.

  18. 18
    IC
    January 8th, 2009 6:50 am

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

  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. ++”

  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.

  21. 21
    Desire Dupas
    January 8th, 2009 7:14 am

    Seems to work ! Great !!!

  22. 22
    Rene
    January 8th, 2009 7:27 am

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

  23. 23
    Sal Azad
    January 8th, 2009 7:33 am

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

  24. 24
    Merchndise
    January 8th, 2009 7:40 am

    Thanx! Will give it a go.

  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.

  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.

  27. 27
    Mediumjones
    January 8th, 2009 9:53 am

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

  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

  29. 29
    KRAPPS.com
    January 8th, 2009 10:30 am

    Thanks for the info Samshing Mag and great job Ricardo …. Twitter is exploding in popularity so perfect timing on this plug-in!

  30. 30
    Timothy
    January 8th, 2009 11:35 am

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

  31. 31
    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.”

  32. 32
    Ricardo Sousa
    January 8th, 2009 12:47 pm

    @Chris Wallace (#31):

    Can you explain better what you mean? :)

    Thanks

  33. 33
    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?

  34. 34
    Michael
    January 8th, 2009 4:06 pm

    Love it – will be implementing asap.

  35. 35
    Mitch_Nash
    January 8th, 2009 4:07 pm

    Thanks – appreciate it.

  36. 36
    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

  37. 37
    bradyG
    January 8th, 2009 4:40 pm

    Nice plugin. Works like a charm.

  38. 38
    Alex Ch
    January 8th, 2009 6:42 pm

    Brilliant :)

    Thanks
    Alex

  39. 39
    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!

  40. 40
    Carlos Guadián
    January 9th, 2009 12:40 am

    Testing…

  41. 41
    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

  42. 42
    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

  43. 43
    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?

  44. 44
    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!

  45. 45
    wannesdeloore
    January 9th, 2009 4:20 am

    cool! and nifty.

  46. 46
    Daniel
    January 9th, 2009 4:58 am

    Very nice plugin, and good post. :)

  47. 47
    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!

  48. 48
    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

  49. 49
    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.

  50. 50
    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.

  51. 51
    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.

  52. 52
    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

  53. 53
    hoshiyuki
    January 9th, 2009 10:24 pm

    nice!

  54. 54
    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!

  55. 55
    isabela
    January 10th, 2009 7:53 am

    Very nice plugin !

  56. 56
    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!

  57. 57
    JC Place
    January 10th, 2009 12:34 pm

    Great plugin, thanks alot.

  58. 58
    karl prosser
    January 10th, 2009 1:42 pm

    testing to see if this does work

  59. 59
    micmerty
    January 10th, 2009 9:56 pm

    super dooper … downloading now!

  60. 60
    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.

  61. 61
    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.

  62. 62
    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

  63. 63
    Goyal
    January 11th, 2009 9:52 pm

    Awesome plugin – thanks!!

  64. 64
    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

  65. 65
    nAODI
    January 13th, 2009 12:32 am

    This sounds cool !

  66. 66
    Denis
    January 13th, 2009 3:16 am

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

  67. 67
    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.

  68. 68
    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?

  69. 69
    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?

  70. 70
    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, “”)

  71. 71
    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

  72. 72
    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?

  73. 73
    WP Cult
    January 15th, 2009 11:13 am

    That is really awesome, I really like this idea!

  74. 74
    Cristian
    January 15th, 2009 1:41 pm

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

  75. 75
    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

  76. 76
    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!

  77. 77
    DoctorFu
    January 17th, 2009 7:36 pm

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

  78. 78
    Ricardo Sousa
    January 19th, 2009 6:12 am

    @DoctorFu:

    Hope to have one till the end of the week.

    Cheers

  79. 79
    Rogov Dmitry
    January 23rd, 2009 5:00 am

    Nice, tnx

  80. 80
    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

  81. 81
    Nicolas TAFFOREAU
    January 26th, 2009 3:04 pm

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

  82. 82
    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?

  83. 83
    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

  84. 84
    disklayekly
    February 10th, 2009 7:38 pm

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

  85. 85
    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 :)

  86. 86
    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?

  87. 87
    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.

  88. 88
    Jorin Cowley
    March 5th, 2009 2:46 am

    Are you using this plugin?

  89. 89
    Michael SteelWolf
    March 5th, 2009 5:40 am

    Same question as Suz above.

  90. 90
    Tom Graham
    March 6th, 2009 6:35 am

    Cool

  91. 91
    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.

  92. 92
    Travis
    March 31st, 2009 9:57 am

    Is this plugin still being developed?

  93. 93
    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

  94. 94
    Paul Pichugin
    April 2nd, 2009 9:08 pm

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

  95. 95
    yugom
    April 3rd, 2009 3:33 am

    thanks…

  96. 96
    joe
    April 5th, 2009 8:57 pm

    yeah!

  97. 97
    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

  98. 98
    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?

  99. 99
    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.

  100. 100
    Jagadish
    April 21st, 2009 4:36 pm

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

  101. 101
    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.

  102. 102
    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.

  103. 103
    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

  104. 104
    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?

  105. 105
    Chris
    May 11th, 2009 1:32 pm

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

  106. 106
    ervin
    May 13th, 2009 12:35 am

    Fantastic…gonna try it

  107. 107
    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

  108. 108
    Tolga
    May 15th, 2009 8:37 am

    thank you, that is exactly what i was looking for

  109. 109
    Boloo
    May 21st, 2009 11:49 pm

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

  110. 110
    Luc
    May 29th, 2009 1:29 pm

    Is it magic ?

  111. 111
    Kay
    June 5th, 2009 7:19 am

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

  112. 112
    yinin
    June 17th, 2009 6:15 pm

    我试验一下

  113. 113
    tasarhane
    June 21st, 2009 9:36 am

    its pretty useful.. thanks

  114. 114
    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.

  115. 115
    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?

  116. 116
    eliezer
    July 8th, 2009 12:27 pm

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

  117. 117
    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?

  118. 118
    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.

  119. 119
    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?

  120. 120
    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.

  121. 121
    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

  122. 122
    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.

  123. 123
    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.

  124. 124
    ruud
    July 12th, 2009 10:53 am

    Hi,

    Tried this above but the Twavatar plugin works easier.

  125. 125
    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!

  126. 126
    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 :(

  127. 127
    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

  128. 128
    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.

  129. 129
    NovRain
    July 30th, 2009 9:07 am

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

  130. 130
    Andres
    August 3rd, 2009 2:03 pm

    What if I have both Gravatar and Twitter?

    (EDIT-> shows Gravatar)

  131. 131
    josh
    August 6th, 2009 7:49 pm

    will you be able to get this to work again?

  132. 132
  133. 133
    André Câmara
    August 10th, 2009 3:22 pm

    test

  134. 134
    Boloo
    August 24th, 2009 4:20 am

    I think this is not working

  135. 135
    wartoon
    August 26th, 2009 7:27 am

    What does this use?

  136. 136
    tamilsweet
    September 9th, 2009 12:24 am

    Thanks!!!

  137. 137
    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

  138. 138
    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!

  139. 139
    Robson Niedson
    October 7th, 2009 7:03 am

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

  140. 140
    WelcomeToTheSky
    October 8th, 2009 6:50 am

    Great, I get it :)

  141. 141
    jerome robins
    October 14th, 2009 3:24 pm

    testing

  142. 142
    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 :(

    • 143
      Gemma Wild
      December 29th, 2009 2:50 pm

      Hi Jerome

      Ignore the instructions found in the following article: http://www.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.

  143. 144
    Gina
    October 16th, 2009 5:48 am

    Testing to see how it all turns out .

  144. 145
    singh
    October 19th, 2009 7:55 am

    lets see

  145. 146
    Jimmy Liew
    November 12th, 2009 9:12 am

    That is great! It really helpful

  146. 147
    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

  147. 148
    Wagsdoode
    November 19th, 2009 3:24 pm

    блог прекрасный. ни пуха ни пера

  148. 149
    offsetik
    November 30th, 2009 1:02 am

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

  149. 150
    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

  150. 151
    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.

  151. 152
    Athena
    January 3rd, 2010 7:10 pm

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

  152. 153
    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???

  153. 154
    Usdating
    January 10th, 2010 2:30 pm

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

  154. 155
    ejaz
    January 14th, 2010 6:07 am

    testing testing

  155. 156
    ejaz
    January 14th, 2010 6:38 am

    ?????

  156. 157
    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

  157. 158
    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?

  1. 00

    There are no trackbacks at this time. If you are interested in leaving a trackback, please use this URL.

Leave a Comment

Make sure you enter the * required information where indicated. Please also rate the article as it will help us decide future content and posts. Comments are moderated – and rel="nofollow" is in use. Please no link dropping, no keywords or domains as names; do not spam, and do not advertise!



Advertisement Advertise with us!
Join in Smashing Forum
Post your job