The attached patch updates Twitter.module for Drupal 6, adds full *incoming* support for twitter XML feeds, and adds a stupidly large number of additional integration points.

Among other things, it also includes 'twitter_log', a module that pipes emergency-level watchdog messages to a twitter account. It sets up an optional user/%/twitter page on the user profile, local caching of tweets for reduced load on twitter, etc. etc. Sidebar blocks, too. That's nice.

There are some tricky bits that aren't yet finished -- for example, there's support in twitter_integration.module for rolling up all of a user's tweets for a day into a single consolidated blog post. The backend work for that is finished but the cron task that does the heavy lifting of creating it needs to be written.

Comments

eaton’s picture

Status: Active » Needs work
StatusFileSize
new45.18 KB

Updated version. twitter_ping.module has been rolled into twitter_integration.module, and now each user with proper permissions can set up their own preferences for whether their posts are announced to twitter. In addition, incoming tweets can now be rolled up into a node every week/day/etc.

Also, twitter_actions.module offers integration with actions.module. You can now, say, fire off a tweet whenever a new user registers or cron runs or what not.

More testing needed, but lots of twittering fun to be had.

papyromancer’s picture

I'm having trouble getting this to work. It seems like the appropriate database tables were not installed.

eaton’s picture

StatusFileSize
new44.17 KB

And here's the latest version. With updated .install files to match the latest and greatest schema foo.

eaton’s picture

Status: Needs work » Needs review
StatusFileSize
new44.15 KB

...aaaaand a fix to a minor issue in the cron updating. it was skipping the first account in every list due to a silly error in db_query_range() params.

yelvington’s picture

Jeff, your most recent patch throws this error on activation of the twitter integration modules:

Fatal error: Cannot redeclare twitter_integration_install() (previously declared in .../sites/all/modules/twitter/twitter_integration.install:9) in .../sites/all/modules/twitter_integration.install on line 10

eaton’s picture

StatusFileSize
new51 KB

This version fixes a few minor bugs, adds rudimentary Views2 support, and adds another module -- twitter_block -- that gives users the ability to post to arbitrary twitter accounts via a sidebar block. It has a JS character counter and all the other nice bits.

sirkitree’s picture

StatusFileSize
new343.34 KB

On /user/%/twitter and /user/%/edit/twitter -- received error before any twitter information was yet saved:
user warning: Table 'db203_sirkitree.twitter_account' doesn't exist query: SELECT *, tu.screen_name AS screen_name FROM twitter_user tu LEFT JOIN twitter_account ta ON (tu.screen_name = ta.screen_name) WHERE tu.uid = 1 in /home/203/domains/sirkitree.net/html/sites/all/modules/contrib/twitter/twitter_integration.module on line 286.

Then upon trying to save user information on /user/%/edit/twitter I've attached the list of errors as a screenshot. These are happening because the twitter_account table is not being created in the install process. There is twitter_user and twitter_node, but no twitter_account.

sirkitree’s picture

Also, now that I've tried to save, I have a permanent error message on my front page:
user warning: Table 'db203_sirkitree.twitter' doesn't exist query: SELECT t.* FROM twitter t LEFT JOIN twitter_node tn ON t.twitter_id = tn.twitter_id WHERE tn.nid = 6 in /home/203/domains/sirkitree.net/html/sites/all/modules/contrib/twitter/twitter_integration.module on line 191.

This is displayed 6 times, even though I have no block displayed or anything. Should there be a call to this module from the front page?

eaton’s picture

That's doubly bizarre -- twitter.install, which should have run before any of twitter_integration's code is actually in use, creates both of those tables. Have you somehow enabled twitter_integration without twitter, or did the twitter.install module not come through in the patch? I'm taking a look. Thanks!

sirkitree’s picture

Yeah they never showed up. Here's a directory listing:

/twitter$ ls
CVS twitter.module twitter_actions.info twitter_block.info twitter_integration.info twitter_integration.pages.inc
twitter.info twitter.patch twitter_actions.module twitter_block.js twitter_integration.install twitter_log.info
twitter.info.orig twitter.views.inc twitter_block.css twitter_block.module twitter_integration.module twitter_log.module

eaton’s picture

StatusFileSize
new54.68 KB

Yep, that was the problem. Here's the patch with ALL the files added.

Thanks for spotting it!

sirkitree’s picture

Thanks eaton, much better. I can use this on my site, so cool!

However, I am getting error on /user/% now:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'theme_twitter_integration_status' was given in /home/203/domains/sirkitree.net/html/includes/theme.inc on line 591.

Looks like maybe you forgot to add function theme_twitter_integration_status(){...} which is called on the provided blocks for theming $items[]

zvizvi’s picture

Category: feature » support

hi eaton,
I took the patch from comment#11 and applied it on the twitter module I downloaded from http://drupal.org/project/twitter(right?). Drupal refuses to alow me to enable to plugin saying the version is incompatible. looking at twitter.info, I see the version remained 5 -

I could've fixed it myself, of course, just to allow deployment, but I'm afraid that it indicates I'm doing something wrong (being an almost complete newbie) or that there are other files which aren't up to date.

could you please assist?

thanks,

kartar’s picture

I patched and uploaded the module using the patch from comment #11. I can see most of the funtions - actions, can configure Twitter user/password in profile - but the Tiwtter import and roll up as a node function seems absent? From the code this should also be configured from the profile but no options appear. Any ideas?

gábor hojtsy’s picture

Eaton: why not talk to walkah about taking over or co-maintaining this module?

. - dot’s picture

Will this module enable people to choose particular people they want to hear from - on say drupal - and get the messages that they have posted (with a twitter when they do).

eaton’s picture

Eaton: why not talk to walkah about taking over or co-maintaining this module?

We just chatted about it this morning, and there are a couple of particular issues that need to be ironed out before this module is ready for prime time. I'll be putting those changes through shortly. Woo!

robloach’s picture

This patch is awesome!

pfaocle’s picture

Wow, great work on this! Was playing around with a patched up version (patch #11 didn't apply properly, btw), but I fell at the first hurdle - the form at /user/uid/edit/twitter doesn't submit/save the settings properly. Eaton, is it worth me starting to poke around with this, or is there another patch on the way?

mcncyo’s picture

i patch twitter 5.x-1.x-dev with post #11. and i am getting this error Fatal error: Call to undefined function dsm() in /homepages/5/d244557972/htdocs/modules/twitter/twitter.module on line 114

this is when i was adding my twit username and password to my profile

pfaocle’s picture

Looks like you've patched with the very first patch in the thread (in the first post or comment #1, not #11), which contained a debug call to dsm() - an aid for developers using the devel module.

Try the more recent patch #11 and see how it goes!

robloach’s picture

Status: Needs review » Reviewed & tested by the community

I'd say commit this and then create new issues for problems that popup.

designerbrent’s picture

...

aaron’s picture

i'm getting the same error as sirkitree at #12, after installing all the new modules, activating the three provided blocks, and setting up my user twitter status.

aaron’s picture

Status: Reviewed & tested by the community » Needs work

and that's with the patch at #11

eaton’s picture

Status: Needs work » Fixed

The core API integration has been committed to HEAD, but with much cleaner association of user accounts. I'm closing this issue for now, as a lot of the side modules (twitter_block, twitter_actions, twitter_log) are superfluous, or can be added in a subsequent patch or be implemented in side modules now that the core API is ported. w00t!

Those interested can also hit up http://drupal.org/node/268080 for full views integration. It implements full Views 2 support and a number of nice listing pages and sidebar blocks via Views.

walkah’s picture

I should add - a super huge thanks to Eaton for all his awesome work on this patch. It's been a fun topic of debates whenever we're together ;-)

eaton’s picture

I'm still convinced walkah committed it just so it would stop accruing features.

minesota’s picture

subscribed :)

domesticat’s picture

A request - perhaps I overlooked something, but I had no idea this module was now PHP 5 only until after I'd downloaded it, run the patch, and went to the module administration page. Maybe I missed a note somewhere? A readme file or something along those lines would be a good thing to add.

I was pretty disappointed that I didn't get to play with the new features. They sound nifty.

(...and no, I don't have any hope of being able to move to PHP 5 soon, so unless Scylla or Charybdis opts to pity me, I'm out of luck here.)

eaton’s picture

A request - perhaps I overlooked something, but I had no idea this module was now PHP 5 only until after I'd downloaded it, run the patch, and went to the module administration page. Maybe I missed a note somewhere? A readme file or something along those lines would be a good thing to add.

You're right. The big dependency is the SimpleXML library that allows the Twitter module to parse incoming information -- it's built into PHP 5, but absent from PHP 4. It might be possible to expose just the 'post TO twitter' features, and disable the 'pull information FROM twitter' features, but that would add some additional complexity to the version checking. Hmm.

Shai’s picture

Hi gang,

I'm new to this thread/module and have some questions, observations:

  1. Are all patches against the June, '07 dev D5 version?
  2. There is no D6 branch version on the project page. Anything in particular holding this up? Is that what is also causing the issues that are really D6 to be labeled as D5?
  3. Seems like Jeff Eaton's work on the D6 version constitutes an almost total reworking of the module. I'd love to hear Eaton's assessment on how much work it would be to back port it to D5.
  4. There is some modest amount of work that has gone into improving the D5 version. Pending anyone committing to back-porting Eaton's work, it would make sense to commit that work to another dev version of Twitter D5.
  5. The project page gives no hint to all the work that has gone on and is going on regarding this module. I think that's confusing to visitors just happening by.

Shai

eaton’s picture

Hey, Shai! Nice to see you again :)

A couple quick summaries of where things are at with Twitter module...

  1. This patch was against the HEAD version of the module, but a subset of the functionality in this patch has already been committed to the HEAD version of the module in CVS. There is an additional patch to complete some of the administrative UI, and to add Views support, at http://drupal.org/node/268080. Features that aren't being included (the Post To Twitter block, and the TwitterLog module, are ones I'm not terribly worried about...
  2. Because the D6 branch is still under development, it hasn't been tagged and branched yet. It still live in CVS HEAD. When the final bits of the Views integration patch from http://drupal.org/node/268080 are finished, an official 6.0 release will probably be re-rolled.
  3. Yep, it's totally rewritten. Of course, the old module was only 80 lines long -- even a few changes would've constituted a total rewrite, so there wasn't a huge amount of code tossed out. There are a lot of bits that would make a backport to D5 tricky -- heavy lifting would need to be done to replace drupal_write_record() references with hard SQL calls, the install file would need to be ported back, and the Views integration wouldn't really be able to work in the same way at all. the API functions themselves -- the ones that post to twitter and pull twitter data -- would be fairly easy to port as long as PHP5 and SimpleXML are available.
  4. I'd probably suggest that any critical patches for the D5 version just be applied to that branch, treating it as a standalone 'prior version' of the module.

That's all I've got right now! ;-)

Shai’s picture

Jeff,

Thanks so much for spelling all that out! I agree with your conclusion in #4 that modest improvements already being worked on should be applied to 5. And the all new Twitter for D6 is just one more motivation for movin' people along to D6.

When you release it I think that its tag should be 6--2-0, don't you think? And the release for D5 would be 5--1-0. This way it's pretty clear from the tags alone the code is significantly different between the D5 and D6 versions, not simply a port.

Best,

Shai

pfaocle’s picture

"When you release it I think that its tag should be 6--2-0, don't you think? And the release for D5 would be 5--1-0. This way it's pretty clear from the tags alone the code is significantly different between the D5 and D6 versions, not simply a port."

Sounds sensible to me!

eaton’s picture

walkah also gave me the thumbs up to do some of this stuff, and I now have CVS access as well. I checked in the current state of the Views2 integration, and tagged it as the DRUPAL-6--2 branch. I'll be adding a dev snapshot shortly.

Shai’s picture

Jeff,

Awesome! Congratulations.

Now that Twitter for D6 has a warm and cozy home in CVS, do you see any reason not to commit the modest improvements a few of us have been working on for Twitter D5?

I've sent a note to Walkah for co-maintainer status. I see myself solely focusing on the D5 version for now.

But it's fine with me not to be a mainainer if you or James went ahead and made the commit. One reason why I'm kind of urgent to update the .dev version is that there are still a bunch of fixes to be made and it would be nice to have more focused patches on top of a more recent base point than one that is more than a year old.

Shai

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.