Hi there,

I would like to allow users to add their own RSS feeds, I want to use Drupal 7.x Feeds for this. The thing that I cannot figure out is how I can check if an URL already exists and give a warning message to the user when it does. The problem I have is that users now can add their own URL to a RSS feed, and in some cases that URL already might exist.

I tried setting the URL to unique in the Feed Mapping but that doesn't do what I want.

Comments

MegaChriz’s picture

Related issues: +#2199981: Unique Feed URL

Same issue, but for the D6 version: #2199981: Unique Feed URL

blogook’s picture

I created my own module to perform a check. The check must be done in presave bcs during validation the Source feed is not altered by Feeds yet. Now, if anyone knows a nice way to set an error and go back to the form, that would be fantastic :)

function mymodule_node_presave($node) {
    if($node->type == "feed") {
        $url = $node->feeds['FeedsHTTPFetcher']['source'];

        $result = db_query('SELECT * FROM {feeds_source} WHERE source = :url', array(':url' => $url));

        if ($result->rowCount() > 0) {
            drupal_set_message(t('Duplicate source feed!'), 'error');
            drupal_goto('<front>');
            }

    }
    
}