Skip to content

Use API to exclude replies in Twitter Profile widget #4

Description

@simonwheatley

Issue reported by @sc0ttkclark over on the WP support forums: http://wordpress.org/support/topic/twitterprofileconstruct_profile_url?replies=1

Please add to the construct_profile_url in TwitterProfile, the exclusion of replies. Otherwise, if a Twitter account consists of mostly replies at a given moment, the count won't matter and will only end up giving Twitter Tracker the non-replies along with replies, leaving the true tweets used -- less than the count was intended to return.

The only drawback here is that Twitter's API is busted, if you say exclude replies, it's still return less than the count you specify to Twitter directly, as their code must be doing the exact same thing as Twitter Tracker :)

Once they do fix their API though, this tweak will really kick in and increasing the max_tweets will no longer be necessary to pad for this eventuality. For now, I also suggest increasing the max_tweets to multiplying by 3.

protected function construct_profile_url() { $include_retweets = $this->include_retweets ? 1 : 0; $hide_replies = $this->hide_replies ? 1 : 0; $url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=%s&count=%d&include_rts=%s&exclude_replies=%s'; $this->profile_url = sprintf( $url, urlencode( $this->username ), (int) $this->max_tweets * 3, $include_retweets, $hide_replies ); }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions