Extension:TweetANew

Description
Updates a predefined Twitter account each time a new article is created or edited. URLs are shortened using bitly service. Settings allow you to enable automatic tweets for either edits or new articles. You can then allow a checkbox to be placed on the edit page to enable a tweet to be sent.

Requirements
The following requirements must be satisfied for the TweetANew extension to work.
 * MediaWiki 1.17 or newer (due to usage of ResourceLoader)
 * PHP cURL is required; https://secure.php.net/manual/en/curl.installation.php
 * Install; http://stackoverflow.com/questions/8014482/php-curl-enable-linux

Install the extension
1. Add the following to LocalSettings.php:

2. Users should have a Twitter account and request API permissions (OAuth settings and tokens). You can register at http://dev.twitter.com. Be sure to have write and read permissions for both OAuth settings and Your access token.

3. Set Twitter OAuth Settings and Access Tokens in your LocalSettings.php:

4a. Users wishing to enable use of bitly URL shortening should have a bitly account and API key.

4a.1. Add the following 2 lines to your LocalSettings.php:

4b. Users wishing to enable use of Goo.gl URL shortening should have a Google account, API key, and Google shortener API enabled.

4.1. Add the following 2 lines to your LocalSettings.php:

Additional configuration parameters are below.

Recent changes setup
Mimic the Special:RecentChanges output so your tweet displays as: m URL - PAGENAME;. . USERNAME (SUMMARY) Example tweet: http://www.examplewiki.org/w/Test1 - Test1;. . Jimbo - Added a section talking about the history of test1 Example tweet for a minor edit: m http://www.examplewiki.org/w/Test1 - Test1;. . Jimbo - Fixed a typo in the history section

Follow these steps: 1. Change your LocalSettings.php to disable random tweet messages, display the author, display the summary:

2. If you'd like to output minor edits as well, also change your LocalSettings.php by adding:

3. Change the look of the default message settings in MediaWiki:Tweetanew-newdefault and MediaWiki:Tweetanew-editdefault to customize the appearance. Use these parameters:
 * $1 is title of the new page
 * $2 is the final URL of the new page - shortened if a service is enabled via this extension

Custom look for tweets about minor edits
Customize the indicator used for tweets about minor edits. Example tweet: minor:NEW PAGE: Test1- http://www.examplewiki.org/w/Test1

Follow these steps: 1. Change your LocalSettings.php to enable tweets about minor edits and, for the above example, use the default tweet message rather than random tweet messages and remove the space after the minor edit indicator

2. Change the look of the default minor edits indicator in MediaWiki:Tweetanew-minoredit.

Upgrading from TweetANew 0.2
Aside from the new features, the main differences between the two versions are the formatting of settings and use of bitly being disabled by default.

You will need to update these settings in your LocalSettings.php:

To:

Twitter's t.co service performs a similar task as bitly. It also provides analytics (although the Twitter Web Analytics tool is not yet available) and is automatically applied by Twitter's API to any submitted URL. You can still choose to use bitly rather than t.co by setting:

You will also need to update these settings in your LocalSettings.php:

To:

Upgrading from SendToTwitter
SendToTwitter's use of Twitter username and password, rather than this extension's use of Twitter's API, means you'll need to do a fresh installation in regards to your settings. Please see installation section.

The wiki URL settings are no longer required.

Upgrading from SendToTwitter2
SendToTwitter2's use of Twitter username and password, rather than this extension's use of Twitter's API, means you'll need to do a fresh installation in regards to your settings. Please see installation section.

The wiki URL settings are no longer required.

The edit page checkbox is only enabled if auto-tweets for either new or edited pages is disabled (see #). To keep SendToTwitter2's checkbox settings, update these entries in your LocalSettings.php:

To: The default for $wgTweetANewBitly['Checked'] is already 'false' - so there's no reason to update your LocalSettings.php to retain that setting.

Upgrading from Wiki2twitter
Wiki2twitter's use of a separate settings file, rather than this extension's use of LocalSettings.php, means you'll need to do a fresh installation in regards to your settings. Please see installation section.

Release notes

 * 1.0.20140209 : 09 February 2014
 * Call Twitter API 1.1 instead of 1.0 (Thank you Dereckson!)
 * Improve UTF-8 and links support (Thank you ISAKA Yoji and Dereckson!)
 * Added Blacklist (Thank you FrankSoyer)
 * Added support for Goo.gl URL shortener (Requested by WhiteTigerItaly)
 * Bug fixes


 * 1.0.20111229-beta : 30 December 2011
 * Updated coding to meet MediaWiki coding conventions
 * General code cleanup
 * Moved extension to code repository for extensions for collaborative developer editing and maintenance
 * Localisation integration for easier use by foreign-language wikis
 * Merged original TweetANew (by Joachim De Schrijver) with the Wiki2twitter (by Wendell Gaudencio), SendToTwitter (by Rohit Keshwani) and SendToTwitter2 (by Rohit Keshwani and Andrew Fitzgerald) extensions
 * Now tweets edited articles (if last edit was made 5+ minutes - unless $wgTweetANewTweet['LessMinutesOld'] setting overrides the default)
 * Ability to use LocalSettings.php settings to enable or disable both the tweets about new and edited pages
 * Checkbox on edit page can be enabled if either "auto-tweeting" of new or edited pages is disabled - if checked a tweet will then be sent
 * Checkbox overrides $wgTweetANewTweet['SkipMinor']
 * Use of ResourceLoader for importing OAuth script - which is now included in the extension
 * Ability to indicate minor edits (if $wgTweetANewTweet['SkipMinor'] = false)
 * Ability to append tweets with edit summary excerpt
 * Use of random tweet messages
 * Default tweet message can now be set in MediaWiki:Tweetanew-newdefault and MediaWiki:Tweetanew-editdefault
 * Other customizations and features from merger of Wiki2twitter, SendToTwitter and SendToTwitter2 features
 * Thank you to Johnduhart, Reedy, SPQRobin, krinkle, Nikerabbit, Raymond and others for feedback, bug reporting and cleaning up code for this beta version


 * 0.2 : 12 September 2011 by Joachim De Schrijver
 * Ignoring images (jpg/png)
 * Using URL shortener
 * Added 'efficiency tracing parameters' to the URL


 * 0.1 : 23 July 2011 by Joachim De Schrijver
 * First version

Planned features

 * Additional short-url services

Wish list

 * Your requests and ideas are welcome
 * Option to only tweet if $user has an EditCount > X (to prevent tweeting about articles made by spammers)
 * More control over which edits results in twitter posts. Could for example be controlled at group level (has to be member of... or ignore groups....)  In my particular case I have a bot creating new articles and they are actually the only ones I want posted - in other words for me a memberof=bot would do the trick.  An alternative could be control at category level - ie. only posts from certain categories.

Ideas being considered
Time will be spent on these if folks show interest on the wish list or talk page
 * Addition of "efficiency tracing parameters" to the URL
 * Previous setup seemed to conflict with certain setups
 * Suggest use of bitly or Twitter's t.co analytics as alternative solutions
 * Allow customization of how summary is displayed in tweet

Requests by developer

 * Add any wishes to wish list or request on talk page
 * Please test on wikis and report back via talk page
 * Requires at least MW1.17 due to use of ResourceLoader
 * Suggestions from developers are especially welcome! Contributions included will be credited as co-authors
 * Language translations will be credited