First up: I realise this may be quite difficult given the probability that people mess with their input filters.
Having the tweet content stored as plain text seems counter-productive to me. Surely the reason you would store it is to display it somewhere on your site. If it is stored in plain text it converts all of the html markup to special characters and that breaks links and makes it unusable.
It would be nice if the default was for this field to be stored as filtered text. I tried changing the field over in structure/content but newly imported tweets did not use the default input filter provided and thus the field became unusable.
As a workaround (for anybody else with this issue) I created a small custom module with the following code:
<?php
function MYMODULE_node_presave($node){
if ($node->type == 'twitter_tweet_feed'){
$node->field_tweet_contents['und'][0]['format'] = 'html';
// Unpublish retweets and reload
if (preg_match('/RT/', explode(' ', $node->field_tweet_contents['und'][0]['value'])[0])){
$node->status = 0;
}
}
}
There's also a command in there that unpublishes retweets; another potentially useful thing.
Comments
Comment #1
darvanenComment #2
ElusiveMind CreditAttribution: ElusiveMind commentedComment #3
ElusiveMind CreditAttribution: ElusiveMind commentedThe second part of this might be useful as an option.
Changing the input type could have negative consequences for views and hook_tweet_feed_tweet_save($node, $tweet) - that would be another potential place for you to have your hook as opposed to node_presave since the hook in the tweet feed module doesn't fire on every node pre-save.
Having said that, It is possible to either unpublish with the same hook, or prevent the saving of node by clearing the $node variable - however that will cause errors in 3.0 - something I will address in 3.1
However, I think that some configurable options around re-tweets is a good idea.
Comment #5
ElusiveMind CreditAttribution: ElusiveMind commented