Twitter Commenters is a plugin for Movable Type that enables commenters to sign-in and comment on your blog using their Twitter account. Versions 2+ includes support for Twitter's OAuth authorization system and enables commenters to automatically share their comments to their Twitter stream.
Note: Version 2.1 fixes a serious bug when using OAuth, users would get a Comment Submission Error, saying that Name and Email are required. All sites running v2.0 should upgrade to v2.1 using the download link below. Simply upload the new files, no need to adjust settings or templates
Basic Auth (default):
Twitter comment authentication works like other auth methods in MT -- once you have installed the plugin you can enable Twitter as one of the auth options, as shown in the image above.
How It Works - Basic Auth
When the user enters their Twitter username and password in the form (shown above), the plugin submits those to the Twitter API to verfiy the credentials. If verified, the user can then post comments using their Twitter account. Their Twitter 'display name' will be shown beside their comments, and their Twitter avatar (profile photo) will be imported and shown beside their comments (if userpics are enabled in your templates).
Note that users' Twitter passwords are not stored in the MT database. An upcoming version of this plugin will enable Twitter's new OAuth support, in which case passwords would never be sent to MT at all. That version will like have an option for commenters to cc. their comments to their Twitter account. Stay tuned.
How It Works - OAuth
New in Version 2.0, you can optionally enable Twitter's new OAuth authorization system. With OAuth, user never have to submit their password info to your server. Instead, they click a "sign in with Twitter" button and they are taken to a page on Twitter.com asking them to authorize the application (see image above). One they click "Allow" they are returned to your site and they then post comments using their Twitter account. As with basic auth, their Twitter 'display name ' will be used as well as their Twitter avatar (profile photo).
Share Comments on Twitter
A new feature in version 2.0, only supported via OAuth, enables commenters to optionally share their comment to their Twitter stream. All they have to do is click a checkbox, no need to re-authorize or enter Twitter account info.
Try it Now
MT Hacks has the new OAuth method enabled. Try it now:
Click here to login with your Twitter account. After logging in, you will be returned to this entry, and you can leave a comment below.
- Net::Twitter 2.07 perl module (included with plugin) (note: do not upgrade to version 2.9+ of this module)
- Net::Twitter::OAuth perl module (included with plugin)
- Net::OAuth perl module (included with plugin)
- Net::OAuth::Simple perl module (included with plugin)
- JSON::Any perl (included with plugin)
Note: Net::Twitter requires newer versions of the libwww-perl collection of Perl modules. I am not sure what the minimum version required is, but on my server, I had to upgrade in order to get Net::Twitter to work. So if you get strange errors, try installing the latest version in your 'extlib' directory of your MT. Update: A common error message is: "Can't locate object method "default_header" via package "LWP::UserAgent" -- if you see this error, this the problem.
Download Twitter Commenters
,<$MTAjaxRatingVoteCount type="twittercommentersdownloads" id="1"$>,0);">
Downloads: <$MTAjaxRatingVoteCount id="1" type="twittercommentersdownloads"$>
- Upload the contents of the 'plugins' folder to the 'plugins' directory for your MT install.
- Upload the contents of the 'mt-static' folder to your 'mt-static' directory.
- For each blog you want to enable, go to Preferences > Registration and check the box for 'Twitter'.
Enabling Twitter OAuth
Unfortunately, this is not as easy as it could be, maybe Twitter will make it easier in future. To set this up you need to create an Application on Twitter:
- While logged in to your Twitter account, go to http://twitter.com/oauth_clients/new.
- Fill out the form on that page:
- Give it a unique name and description.
- For 'Application Website', enter https://mt-hacks.com/twittercommenters.html. For 'Organization', enter MT Hacks.
- For 'Website' enter https://mt-hacks.com.
- For 'Application Type' choose 'Browser'.
- For 'Callback URL' enter the full URL to your comments script followed by '?__mode=login_external&key=Twitter'. Example: http://www.domain.com/cgi-bin/mt/mt-comments.cgi?__mode=login_external&key=Twitter
- For 'Default Access type' choose 'Read & Write'.
- Check the box for 'Yes, use Twitter for login'
- Hit the 'Save' button.
- After saving the application, you should now see a screen with a 'Consumer key' and 'Consumer secret'. Copy those to the system plugin Settings (System Overview > Plugins > Twitter Commenters > Settings). and save the plugin settings.
- To enable the share comment on Twitter option, add the <mt:TwitterShareCommentOption> tag below the comment text part of your comment form. This will display a checkbox option to people logged in via Twitter OAuth.
- Rebuild your entry pages and test it out
As always, feedback is appreciated.
Follow @mthacks on Twitter for updates and other MT and Twitter hacks.