Could someone create a patch that creates the option to filter out all twitter updates that either start with or have included an @ sign?

And if possible, maybe add an option that adds a "tweply" or "retweet" class name to the div. Would be nice.

Thanks.

Comments

Nimo’s picture

subscribing

td540’s picture

what?

RonStar-1’s picture

Because the twitter module retrieves the status updates via an HTTP GET, all tweets come back as a giant XML array. After it's been converted to an array, each status is cached. I imagine that you could do a compare on the text of the tweet using the usual string-compare functions to filter out whatever you need before the caching occurs. This all takes place in the twitter_fetch_timeline() function in twitter.inc

kylegiveadamn’s picture

you could also perform this this using the views module, and adding a filter to check the message starts with/ does not start with/ contain an @ sign. another method is to edit the 'twitter.inc' file like so

function twitter_cache_status($status = array(), $silent = FALSE) {
db_query("DELETE FROM {twitter} WHERE twitter_id = %n", $status['twitter_id']);

if (substr($status['text'],0,1) != "@")
{
drupal_write_record('twitter', $status);

if (!$silent) {
module_invoke_all('twitter_status_update', $status);
}
}
}

this will store all tweets that don't start with the '@' sign.

hope this helps.

sonlinemedia’s picture

Thanks kylegiveadmin - the filter in views was a great idea!

juampynr’s picture

Status: Active » Closed (works as designed)

Closing.