Open main menu

Extension talk:TweetANew

About this board

doesnt appear to work with 1.25.1 MW

3
Fractalfederation (talkcontribs)

no errors or anything, just nothing happens and even enabling checkbox on edit page never shows up

Sm8ps (talkcontribs)

Same here on MW 1.23.9. I had it working without a flaw on MW 1.19 but the very same configuration seized working after the upgrade. Same symptoms as described by Fractalfederation.

Sm8ps (talkcontribs)

I spoke too soon! Fact is that it ''does'' work when it is set to automatically tweet by its own. Though I cannot get the check-box to appear below the edit window.

Reply to "doesnt appear to work with 1.25.1 MW"
Peachey88 (talkcontribs)

Love this extension! Any chance it could be modified to also post significant updates? Perhaps based on the size of the edit rather than if minor edit was left unchecked. That addition as an option would be great! Here's an example of an extension (Extension:Wiki2twitter) that goes to something of the extreme with this idea.

This post was posted by Peachey88, but signed as Varnent.

Peachey88 (talkcontribs)

You could always edit the hook that is calling the tweet function. I'll see what I can do if I find some time!

This post was posted by Peachey88, but signed as Joa ds.

Reply to "Post major updates as well?"
2001:44B8:2163:5600:D8B4:C93D:2F5D:F99A (talkcontribs)

Hello,

Is it possible to force the tweets into a certain language? Although our wiki is entirely in English, we have users with other language preferences set in mediawiki and when they make an edit, the tweet appears in their language setting.

Thanks!

Reply to "Forcing a language?"

Bitly & googl links are nonexistent

3
JamesGeddes (talkcontribs)

I have tried configuring both bitly and googl URL services but neither display anything on the tweet. What is going wrong?

JamesGeddes (talkcontribs)

I've had to basically remove all references to the links in the tweets, until someone can advise otherwise.

Is this extension still under development? Shame if not, it's pretty great. Working links would certainly make it awesome.

JamesGeddes (talkcontribs)

Bodged a fix - removed the use of bitly and googl. It then uses the native URL, which is actually better in many ways. Still, would be nice if the shorteners worked.

Reply to "Bitly & googl links are nonexistent"
Edmundopg (talkcontribs)

I have installed and configurate it as default congiguration but doesn't send any tweet, here´s my code

http://pastebin.com/QU9HHPVY

My wiki is www.tolkiendili.com

Reply to "Doesn't do anything"
217.5.205.2 (talkcontribs)

Hallo community, I succesful use this extension, but it has still room for improvement: if I create a #redirect, it will be posted on twitter as a new site. It's possible to put this on false? I don't won't show all redirects as new site. Best regards 217.5.205.2 11:10, 6 September 2014 (UTC)

Reply to "Redirects"

Possible to blacklist the whole namespace?

1
Gleki.arxokuna (talkcontribs)

I don't want to show me editing pages in e.g. "Template:" namespace. Is it possible to disable tweeting about them all?

Reply to "Possible to blacklist the whole namespace?"

Patch to support multibyte character (e.g. CJK) and t.co changing

1
Cory (talkcontribs)

TweetANew truncate a tweet too shorten on some languages (Japanese, Chinese, Korean and so on) which have multibyte characher. I rewrite it with PHP mbstring class which process string by character.

日本語などマルチバイト文字を含む場合に所定の140字より短くなる不具合に対応したパッチを下記に置いておきます。試してみてください。(日本語が読める方、詳しくはこちら。)

Please test: https://bugzilla.wikimedia.org/show_bug.cgi?id=60227

Reply to "Patch to support multibyte character (e.g. CJK) and t.co changing"

Trouble-shooting this (excellent) extension + some usage hints

1
Sm8ps (talkcontribs)

Dear fellow Mediawikiarians,

in case you are feeling like I did when things were not working as expected, then don't despair! Even I got it working and so will hopefully you. It took me more than an hour to figure out how things have to be set up. The inter-play with Twitter adds an additional layer of complexity which was completely new to me.

So you have set up and configured this extension

  • on Mediawiki 1.17+
  • with PHP cURL installed (sudo apt-get install php5-curl && sudo service apache2 restart on Ubuntu 12.04).

Everything is working fine? Congratulations! I wish I had your kind of luck once in a while. :) Though, probably you are not even reading this discussion page anyways if your procedures are similar to mine. Otherwise I suggest the following check-list:

  • Adapt the code of the extension to the new Twitter API v1.1 as suggested below by Lbthomsen (and chime in to my thanks to him).
  • Remove any configurations except the Twitter access codes and set $wgTweetANewTweet['LessMinutesOld'] to zero. Go with the defaults otherwise for the testing phase.

You should then receive a first tweet upon creation of a new page. If not:

  • Check that the access level is indeed set to 'read and write' (as explained below).
  • Make sure you created the page in the main article namespace. For it says in the code: Excludes files or content outside of article namespaces.
    • However, I found that this is not fully true. Tweets are sent for newly created pages also in different (non-standard) namespace. However pages in non-main namespaces are ignored for edits no matter what settings I chose.
  • If you get no tweets at all then the cause most likely lies outside the scope of this extension. Post back here if you find any additional points to check.

Working well it seems? If you go ahead and change the settings to your liking (or -- as I did -- if you had chosen your settings ahead and are looking for help on this discussion page like I did but could not find any) then you may have trouble with getting tweets for edits. You seemingly cannot get a consistent behavior from this extension; sometimes it works but most of the times not. Well the cause of evil here is Twitter, adding some rules to the game that novice Tweeties like myself may not be aware of.

One cannot post the same tweet twice (in a row). So if you chose static settings and turned the random parts off then you will not get any tweet if you edit a page twice. There must be some varying part included into your post which in my case is the edit summary. (Thus I have to train my users (and myself) even harder to write edit summaries. Hopefully they will recognize a successful tweet about their work as an additional reward to that chore.)

Knowing that, you can do some more testing and then decide on your settings. Here are mine (leaving out the Twitter API stuff:

require_once("$IP/extensions/TweetANew/TweetANew.php");

$wgTweetANewTweet = array( 'New' => true,            'Edit' => false,    
                           'LessMinutesOld' => 0,    'SkipMinor' => true, );

$wgTweetANewText = array(  'NewAuthor' => true,      'NewSummary' => true,
                           'EditAuthor' => true,     'EditSummary' => true,
                           'RealName' => true,
                           'NewRandom' => false,     'EditRandom' => false,
                           'Minor' => true,          'MinorSpace' => false,    );
 
$wgTweetANewEditpage = array( 'Enable' => true,      'Checked' => true, );

Some notes:

  • Since the extension defines the default values, one must have it included before one's own settings.
  • 'Skipminor' does not override the settings from the check-box ($wgTweetANewEditpage).
  • Setting 'LessMinutesOld' to non-zero makes posts get lost that should be tweeted during the black-out phase after a prior tweet.
  • 'MinorSpace' set to true adds   literally into the tweet. I corrected that in the template page MediaWiki:Tweetanew-minoredit where I added that HTML-code after the text. Since this is parsed by Mediawiki, the space does get included correctly.
Reply to "Trouble-shooting this (excellent) extension + some usage hints"
FrankSoyer (talkcontribs)

Hi staff, I just install your extension and I must say : Bravo ! For my own use, I just made a change : I use a main page called "Accueil" as an index for all other pages. I don't want that additions or modifications on this page to be twitted. So I added an field to the array $wgTweetANewEditpage in LocalSettings.php:

'Blacklist' => array('Accueil',)

and in TweetANew.body.php :

75a76
> 				$article,
193a195
> 				$article,
227a230
> 	 * @param $article Article
232,233c235,236
< 	public static function makeSendTweet( $tweet_text, $finalurl ) {
< 		global $wgTweetANewTwitter, $wgLang;
---
> 	public static function makeSendTweet( $article, $tweet_text, $finalurl ) {
> 		global $wgTweetANewTwitter, $wgTweetANewEditpage, $wgLang;
235,240c238,244
< 		# Calculate length of tweet factoring in longURL
< 		if ( strlen( $finalurl ) > 20 ) {
< 			$tweet_text_count = ( strlen( $finalurl ) - 20 ) + 140;
< 		} else {
< 			$tweet_text_count = 140;
< 		}
---
> 		if ( !in_array($article->getTitle()->getText(), $wgTweetANewEditpage['Blacklist']) ) { 
> 			# Calculate length of tweet factoring in longURL
> 			if ( strlen( $finalurl ) > 20 ) {
> 				$tweet_text_count = ( strlen( $finalurl ) - 20 ) + 140;
> 			} else {
> 				$tweet_text_count = 140;
> 			}
242,244c246,263
< 		# Check if length of tweet is beyond 140 characters and shorten if necessary
<  		if ( strlen( $tweet_text ) > $tweet_text_count ) {
< 			$tweet_text = $wgLang->truncate( $tweet_text, $tweet_text_count );
---
> 			# Check if length of tweet is beyond 140 characters and shorten if necessary
> 			if ( strlen( $tweet_text ) > $tweet_text_count ) {
> 				$tweet_text = $wgLang->truncate( $tweet_text, $tweet_text_count );
> 			}
> 
> 			# Make connection to Twitter
> 			$tmhOAuth = new tmhOAuth( array(
> 				'consumer_key' => $wgTweetANewTwitter['ConsumerKey'],
> 				'consumer_secret' => $wgTweetANewTwitter['ConsumerSecret'],
> 				'user_token' => $wgTweetANewTwitter['AccessToken'],
> 				'user_secret' => $wgTweetANewTwitter['AccessTokenSecret'],
> 			) );
> 
> 			# Make tweet message
> 			$tmhOAuth->request( 'POST',
> 				$tmhOAuth->url( '1.1/statuses/update' ),
> 				array( 'status' => $tweet_text )
> 			);
246,259d264
< 
< 		# Make connection to Twitter
< 		$tmhOAuth = new tmhOAuth( array(
< 			'consumer_key' => $wgTweetANewTwitter['ConsumerKey'],
< 			'consumer_secret' => $wgTweetANewTwitter['ConsumerSecret'],
< 			'user_token' => $wgTweetANewTwitter['AccessToken'],
< 			'user_secret' => $wgTweetANewTwitter['AccessTokenSecret'],
< 		) );
< 
< 		# Make tweet message
< 		$tmhOAuth->request( 'POST',
< 			$tmhOAuth->url( '1/statuses/update' ),
< 			array( 'status' => $tweet_text )
< 		);
Reply to "Blacklisting some pages"
Return to "TweetANew" page.