Export to GitHub

sweetcron - issue #3

Feature Request: Customize twitter output to not display certain tweets.


Posted on Aug 28, 2008 by Grumpy Cat

Say you enter a twitter and twitpic account, they update at the same time and produce pretty much the same content, because twitpic automatically updates twitter.

It would be nice if we could make the twitter plugin not display tweets that have "from twitpic" in them as it looks redundant see here:

http://blissofbeing.com/sweetcron/

We could fix this by making the twitter plugin more customizable, like not including the twitpic tweets, it would also be great if we could exclude @replies also.

Comment #1

Posted on Aug 28, 2008 by Quick Horse

You should be able to filter this out in the _activity_feed.php file in your theme. Use get_title() to get the twitter text, and maybe toss in get_feed_domain(). Some basic regex on the results of those will allow you to filter out whatever you want.

Comment #2

Posted on Aug 30, 2008 by Grumpy Dog

Suppose I want to filter out posts on Twitter that came Twitpic. I would probably try to filter on the hyperlink in the Twitter post and use the get_title()object.

This is the default filter for twitter in the activity_feed.php: get_feed_domain() == 'twitter.com'): ?> last"> config->item ('theme_folder')?>images/me.jpg" alt="" /> get_title()?>

How would I add a filter on the hyperlink in the item_title so that posts with a Twitpic url are dropped?

Thanks! Stefan

Comment #3

Posted on Aug 31, 2008 by Happy Giraffe

This is probably not the most elegant place to make this patch, rather look in the

application/plugins/twitter_com.php script

although there's no way to cancel the item, you could return null from the pre_display function for items not to display, and add a in _activity_feed.php

Comment #4

Posted on Aug 31, 2008 by Happy Lion

if i don't want any of my '@' replies to go on the feed then?

Comment #5

Posted on Aug 31, 2008 by Grumpy Dog

Hi Will,

I added the next lines to the twitter plugin:

function pre_display($item) { //Filter posts from Twitpic $url = 'http://twitpic.com'; if (strstr($item->get_title(),$url)){ //echo "Found $url $item"; $return = null; } else { echo "Not Found"; return $item; } }

And added in _activity_feed.php

But I still get the next error: Fatal error: Call to undefined method stdClass::get_feed_domain() in /home/stranger/domains/stranger.nl/public_html/system/application/views/themes/box y_but_good/_activity_feed.php on line 9

Any ideas?

Regards, Stefan

Comment #6

Posted on Sep 1, 2008 by Happy Giraffe

Stefan: the

needs to be around line 4 or 5, before any of the conditions. You are probably checking for null at the twitter section, but it checks for instance if the item came is a blog post before that, and fails. Move the is_null line to right after the

Status: New

Labels:
Type-Defect Priority-Medium