Module: Twitter

thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Mon, 2011-02-14 05:44

Hello. I've just completed a beta release of a Twitter module for Gallery 3. This module allows those with G3 accounts to share Gallery items on Twitter directly from G3. Documentation and download available here:

http://codex.gallery2.org/Gallery3:Modules:twitter.

Please download, install, test, and post feedback here. Thanks!

Support the Gallery project with a donation
--
2tbsp.com

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Tue, 2011-02-15 00:47

UPDATE - Problems fixed. Please download and test!

Sorry folks, I didn't test this well enough before posting. I've restored a required user_id column and am in the process of fixing a problem with Twitter OAuth access_token exchange that's cropped up. I'll post an update as soon as I've corrected the issue.

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Wed, 2011-03-16 01:43

Beta 2 released with the following improvements.

  • Allow users to change from one Twitter account to another from their profile page.
  • Compose Tweet JavaScript widget fixes to read default options, accept custom widget options.
  • Disable the "Tweet" button if the message is over 140 characters.
  • Truncate default tweet values longer than 140.

 
Pher9999

Joined: 2011-09-03
Posts: 1
Posted: Sat, 2011-09-03 07:14

Be sure to have php5-curl extension installed, or it won't work.

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Sat, 2011-09-03 15:27

Thank you. Yes, php5-curl extension is required. I'll add a note about this requirement.

--
2tbsp.com
github.com

 
crystalgirl

Joined: 2011-09-27
Posts: 36
Posted: Sun, 2011-10-23 13:38

I have a new twitter account.

I'm getting this error when I try to share: You must Authorize Gallery to send tweets. The prompt to login, appears to be the g3 URL, not a location on twitter to log in.

I don't recall entering my twitter name/password anywhere into g3, but I haven't seen anywhere to enter it.

In twitter, I have created the app with read/write permission. I have entered OAuth information into g3.

Is this a 'php5-curl' issue?

Sorry if I am not providing enough info here, I'll be glad to expand.

Thanks for any help anyone can provide.

CrystalGirl

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Mon, 2011-10-24 04:45

The first time any G3 account tries to tweet a photo or album, they'll be asked to authorize this. Judging by the message you're seeing, that site is the Twitter authorize page. The G3 Twitter module does not ask for or store your Twitter user name or password, only OAuth tokens.

Be sure that you're logged into Twitter with the account you want to send Tweets to from G3 before you authorize.

--
2tbsp.com
github.com

 
crystalgirl

Joined: 2011-09-27
Posts: 36
Posted: Mon, 2011-10-24 10:51

I am logged in (in another tabbed window). Other apps recognize that I am logged in, but not G3. I believe G3 thinks I am not logged in as the button below the error msg says "sign in with twitter". However, the actual link for the button does not actually sign me in, but instead redirects the to current G3 page displaying an error: "Could not connect to Twitter. Refresh the page or try again later.". I tried both the consumer fields and access tokens (just in case the prompts changed). Neither worked. I tried revoking and unrevoking app access and that had no effect on the G3 behavior.

Any other suggestions?

 
imneo

Joined: 2011-10-24
Posts: 1
Posted: Sun, 2011-10-30 14:14
crystalgirl wrote:
I am logged in (in another tabbed window). Other apps recognize that I am logged in, but not G3. I believe G3 thinks I am not logged in as the button below the error msg says "sign in with twitter". However, the actual link for the button does not actually sign me in, but instead redirects the to current G3 page displaying an error: "Could not connect to Twitter. Refresh the page or try again later.". I tried both the consumer fields and access tokens (just in case the prompts changed). Neither worked. I tried revoking and unrevoking app access and that had no effect on the G3 behavior.

Any other suggestions?

exactly the same issue here

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Sun, 2011-10-30 16:07

Can you confirm that the web server your G3's running on has Curl and the PHP Curl extension installed?
--
2tbsp.com
github.com

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Sun, 2011-10-30 16:08

Also, what version of Gallery 3 are you running? The latest?

--
2tbsp.com
github.com

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Sun, 2011-10-30 16:45

Okay, I just updated my test environment and am having troubles also. I'll start to look into the issue and get back to you.

--
2tbsp.com
github.com

 
crystalgirl

Joined: 2011-09-27
Posts: 36
Posted: Wed, 2011-11-02 16:29

Just now saw the posts requesting additional information.

I have the latest G3. I'm not sure what CURL is.

I'd be glad to follow up with more details if you need them...sounds like the problems are presently reproducible with other environments, so you may have enough information as is.

Looking forward to resolution. Thanks!
CrystalGirl

 
iankearns

Joined: 2011-12-19
Posts: 14
Posted: Wed, 2011-12-21 13:40

Installation was fine and so was Twitter API / BIT.LY creation but when user tries to click on "Share on Twitter" they get the notification to sign in but then get "Could not connect to Twitter. Refresh the page or try again later."

Running Gallery 3.0.2

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2013-06-12 16:17
MarkRH wrote:
Twitter just killed v1.0 of it's API which has broken this module (fails to send tweet). Here's how to fix it:

Edit \modules\twitter\vendor\twitteroauth\twitteroauth.php and change:

  /* Set up the API root URL. */
  public $host = "https://api.twitter.com/1/";

to:

  /* Set up the API root URL. */
  public $host = "https://api.twitter.com/1.1/";

And that's all that needs to be done.

The original support thread was: http://galleryproject.org/node/100791 which is apparently too old to add this reply to.

- Mark H.

Using Gallery 3.0.8 - gallery.markheadrick.com

From: http://galleryproject.org/node/111672

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Thu, 2013-06-13 21:27

Thanks Dave. I'll fix this ASAP.

--
2tbsp.com
github.com

 
shadat12s

Joined: 2013-06-16
Posts: 1
Posted: Sun, 2013-06-16 14:18

by php5-curl extension installed,its not working. whats the problem?

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Mon, 2013-06-17 05:08

Twitter updated their API. I'll fix ASAP.

--
2tbsp.com
github.com

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Mon, 2013-06-17 05:37

A quick fix for those who can't wait for an updated release.

Open the following in the twitter module directory: vendor/twitteroauth/twitteroauth.php

Per the Twitter OAuth libs author, edit the following variables so that they match what's shown here.

public $host = "https://api.twitter.com/1.1/";

public $ssl_verifypeer = TRUE;

public $useragent = 'Custom useragent string';

https://github.com/abraham/twitteroauth

Thanks to Mark H for pointing out the problem.

--
2tbsp.com
github.com

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Thu, 2013-06-20 00:34

Hmmm, wasn't aware of those other two changes. I guess $useragent is just whatever you want it to be, perhaps the Gallery's name in this context or I guess the visitor's browser user agent string could be used?

- Mark H.

Using Gallery 3.0.8 - gallery.markheadrick.com

 
Tornevall

Joined: 2010-11-14
Posts: 2
Posted: Mon, 2013-07-08 19:00
thumb wrote:
Hello. I've just completed a beta release of a Twitter module for Gallery 3. This module allows those with G3 accounts to share Gallery items on Twitter directly from G3. Documentation and download available here:

http://codex.gallery2.org/Gallery3:Modules:twitter.

Please download, install, test, and post feedback here. Thanks!

Support the Gallery project with a donation
--
2tbsp.com

I can't find any file to download.

https://github.com/downloads/ckieffer/gallery3-contrib/twitter-1.tar.gz just gives me file not found-error.

Has it been removed?

http://blog.tornevall.net

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2013-07-08 20:51

https://github.com/ckieffer/gallery3-contrib/tree/master/3.0/modules/twitter

I asked Chad to initiate a pull request with the gallery-contrib repository. Then it should should show up on http://www.gallerymodules.com/

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Tue, 2013-07-09 06:26

Tornevall, Github discontinued their file upload feature several months ago and it appears the Zip file link is now gone. Here's a new link to download a Zip archive of the module.

http://2tbsp.com/system/files/twitter-1.zip

--
2tbsp.com
github.com

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Tue, 2013-07-09 06:27

floridadave, it looks like you submitted a pull request and Bharat accepted, yes?

--
2tbsp.com
github.com

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2013-07-09 16:56

Yes Bharat pulled to the gallery3-contrib repository and it is now available on:
http://www.gallerymodules.com/

Thanks Chad.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
sblainey

Joined: 2013-11-10
Posts: 3
Posted: Mon, 2013-11-11 04:00

Hi All,

Just made an update to this module to post the thumbnail as part of the tweet so it shows up within the user's twitter client:

https://github.com/gallery/gallery3-contrib/pull/172

Regards,
Simon

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Mon, 2013-11-18 23:15

Tried out the changes with the thumbnail being sent along with the tweet (wonder if the resize version would be better). Anyway, slight problem. The tweet dialog that appears before you send the tweet out does not account for the extra length the pic.twitter URL takes up.. so it's real easy to make a tweet that fails to send due to it being too long. Currently, it does pull in and include the bit.ly URL in the tweet so it should probably do the same with the pic.twitter URL so an accurate count can be made. My guess is, that it's tacking something like:

http://pic.twitter.com/8o8CTHVcJt (a valid test tweet I sent out from one of my galleries)

to the end of the tweet, which uses up another 33 characters if I'm doing my math right.

Also, if this is going to be a permanent feature, might want to add an Admin setting to include the image or not in the tweet.

As it stands, I'm tempted to go back to old code that doesn't include it... 33 characters really eats into that 140 characters LOL.

Update: After doing some more testing, the free character count in the dialog needs to be 25 to accommodate the picture URL. Looks like it's basing it off the http://t.co/7dQ9BXfDh1 wrapper url. Anyway, if it fails to tweet out, just keep making the text use less characters. Over time they keep adding more to the end of the URLs.
- Mark H.

Using Gallery 3.0.9 - gallery.markheadrick.com

 
sblainey

Joined: 2013-11-10
Posts: 3
Posted: Wed, 2013-11-20 01:54

Good thoughts... based on your feedback I have:
1. changed to attach resized image rather than thumbnail
2. added a checkbox to the tweet form to select whether or not to attach the image
3. updated the javascript to deduct 25 characters from the limit when the checkbox is checked

Try it out from:
https://github.com/sblainey/gallery3-contrib

and let me know how you go... if all good I'll submit a pull request.

 
sblainey

Joined: 2013-11-10
Posts: 3
Posted: Wed, 2013-11-20 22:32

I have submitted a pull request for this:

https://github.com/gallery/gallery3-contrib/pull/173

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Wed, 2013-12-04 21:19

Finally got around to testing this. Seems to work correctly. Here's my status with the image and my character count to make 0 characters free: https://twitter.com/mrheadrick/status/408343975343702016

Thanks for the update!

- Mark H.

Using Gallery 3.0.9 - gallery.markheadrick.com

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Sun, 2013-12-08 16:09

Yes. sblainey is making enhancements.

--
2tbsp.com
github.com