You'll notice that we are using the excellent 960 Robots Drupal theme for this blog. We aim to showcase several contributed modules and themes over time to show how they can be setup and used etc - using this site as a basis for video casts - in case you were wondering why we don't use our own themes... ; )
Great theme and easy to set up with great features out of the box.
One of the features of this theme is the random tweets in the header. Nice example of how to pull an external sites API query into your site - in this case Twitter.
The theme can be configured to 'search' twitter for a particular word or phrase (say 'yourtittername'). It does this under the bonnet by using the call:
$response = drupal_http_request('http://search.twitter.com/search.json?q=' . $query);A tweet is then selected at random from the results and added to the header - nice!
However one drawback is that you may get the occasional unwanted tweet in there.
So what if you are searching for mytwittername and someone tweets something you don't want to publish by posting it @mytwittername
The last thing you want to see in your header is something negative, abusive or irrelevant but chosen because it happens to mention yourtwittername!!
Well the solution is to head over to the advanced search page at http://search.twitter.com
There you can try out the configuration and you'll see that you can exclude words and phrases like
http://search.twitter.com/search?q=&ands=mytwittername¬s=nastytweeter
or
http://search.twitter.com/search?q=&ands=mytwittername¬s=@mytwitternameThe first will exclude a specific tweeter and the latter will exclude tweets @ your username.
This can be entered into the config option as
mytwittername -@mytwittername