Add Views 2 integration and scope creep

Eaton - June 8, 2008 - 09:13
Project:Twitter
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (code needs review)
Description

Annnnd here's the patch. Provides a 'Twitter messages' base table for Views 2, and links to user information for sites where users have associated Twitter accounts with themselves. This allows for things like a block that shows twitter posts from the user who wrote the current node. In fact, just such a feature is implemented as a default_view in this patch.

Account-specific twitter fields, like the Twitter user icon and URL, are also implemented as fields on the User base table. Thus, a listing of users could include their Twitter account link in addition to their native Drupal info.

This patch is definitely against the HEAD/6.x version, though I can only choose the 5.x version in the dropdown. Sounds like a bug in project.module ;-)

#1

Eaton - June 8, 2008 - 15:31

that's odd. the patch didn't attach.

AttachmentSize
twitter-views.patch19.07 KB

#2

Eaton - June 8, 2008 - 22:41
Title:Add Views 2 integration» Add Views 2 integration and scope creep

Here's an updated version of the patch that fixes a handful of issues with the View.

Also, in order to populate the actual data, this version of the patch adds a hook_cron() implementation that keeps user accounts updated. Also, adds PHPDoc to the functions in twitter.inc.

Also, fixes a handful of bugs, adds new columns to the twitter_account table (number of followers and location), and ponies. Also renames the twitter_fetch_user_*() functions to twitter_fetch_*(), to improve clarity between account information and user information.

No new modules, though, I promise.

AttachmentSize
twitter_views_and_cron.patch40.72 KB

#3

Eaton - June 10, 2008 - 18:21

And while I was in there, I added the ability to delete accounts and toggle their 'import statuses for this account' flag on the user/n/edit/twitter page. No more accidentally adding a Twitter account, never to be able to delete it!

#4

Eaton - June 10, 2008 - 18:26

I... hmm. That's funny, attachments don't seem to be working. For the time being, I've put that file online at http://senduit.com/f997fa ... It will stay live for a week, which should certainly be long enough for file uploading to start working again. :-)

#5

leafish_paul - June 14, 2008 - 20:52

Testing this out - one error on update 6001:

Update #6001

    * ALTER TABLE {twitter_user} ADD import int
    * ALTER TABLE {twitter_user} ALTER import SET default 1
    * UPDATE {twitter_user} SET import = 1
    * Failed: ALTER TABLE {twitter_user} ALTER import SET NOT NULL
    * ALTER TABLE {twitter_account} ADD location varchar(255)
    * ALTER TABLE {twitter_account} ADD followers_count int
    * ALTER TABLE {twitter_account} ALTER followers_count SET default 0

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL' at line 1 query: ALTER TABLE twitter_user ALTER import SET NOT NULL in /var/www/drupal-6.2/update.php on line 77.

#6

Eaton - June 16, 2008 - 13:38

This is definitely a bit odd. db_add_column() is being used exactly as the docs describe, and the same schema definition works fine in the install hook rather than the update hook.

I've attached a 'freshly' rolled version of the patch, and will investigate a bit more.

AttachmentSize
twitter_views_cron_docs_admin_ponies.patch46.31 KB

#7

Eaton - June 18, 2008 - 18:12

The patch as it currently stands has been committed to the DRUPAL-6--2 branch, and further testing can take place there. The update_6001 in particular is only used when migrating from the initial devel version of the module committed last week to the version in this patch, and straight installs appear to work fine. I'm suspicious of an issue in SchemaAPI itself, but need to investigate a bit further. Perhaps that update in particular can be moved to a separate issue while this one is marked as closed? The views integration is "done" now...

#8

christefano - July 17, 2008 - 11:11
Version:5.x-1.x-dev» 6.x-2.x-dev

This seems to be for the 6.x branch.

 
 

Drupal is a registered trademark of Dries Buytaert.