Closed (outdated)
Project:
Feeds
Version:
7.x-2.0-alpha8
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
22 Mar 2010 at 14:10 UTC
Updated:
26 Nov 2025 at 14:45 UTC
Jump to comment: Most recent
Comments
Comment #1
alex_b commentedI just added more documentation on "Programmatic operations" to http://drupal.org/node/622700 - this should answer your questions.
Comment #2
Anonymous (not verified) commentedThank you!
In my case I have added some file uploaded functionality to the user's profile page. Users will upload a CSV file of places they have visited, and once uploaded I want to trigger my CSV Feeds importer to run, using the uploaded file.
From what you wrote, I can guess that the important line for me is the one below (I don't especially need a progress bar)
while (FEEDS_BATCH_COMPLETE != feeds_source('my_importer_id', $node->nid)->import());
A few questions:
1- my_importer_id is the machine name of the importer, correct?
2- Why the need for a $node->nid?
Thanks!
Comment #3
Anonymous (not verified) commentedI've played around with the code and have gotten the following to work:
I've tried it with a test file that contains just one CSV line entry and so far so good. Thanks for pointing me in the right direction!
Closing this issue and I'm raising a new issue at http://drupal.org/node/753580 for a feature request to add a method to change the feed source's Fetcher's source:
Comment #5
Sinan Erdem commentedI am using this code in an action of a rule:
When the rule is triggered it gives the following error:
I also tried 'FeedsHTTPFetcher' instead of 'FeedsFileFetcher' but it doesnt change anything.
Thanks in advance....
Comment #6
automaticerik commentedI've followed everything in here, but it looks like all of this is in reference to a feed that isn't attached to a node. If I have a feed that is attached to a node, how should this be accomplished?
EDIT: Nevermind, found that feeds_source takes a node id as a second argument. Now it works great!
Comment #7
wuinfo - bill wu commentedIf I develop an stand alone php page to trigger the importer, what are the complete set of required php or inc pages needed?
Comment #8
rbennata commentedI'm trying to run the import from an external shell so my code looks like:
It runs, and it even shows on the feed log with "node created" or "node updated". But the nodes are not really created or updated to the database.
Is there some "commit" I also need to do because it is a separate process?
Or - what is wrong with this code?
(this is D7)
Comment #9
sisko commented@Sinan Erdem: I tried your code (#5) in a Rule action on a D7 site and it worked fine
Thank you!
Comment #10
peter panes commentedIs there an easy way to pass the feed itself in from a variable?
Otherwise im just creating extra work and load by saving the contents of the variable to a file just so the feed importer can can load it from the file.
Comment #11
timellemeet commented@peter panes
I tweaked feeds callback fetcher. Instead of passing on a function name a pass on a variable and have a default function simply return that function.
Comment #12
thomaswalther commentedI need to know this for 8.x: https://www.drupal.org/project/feeds/issues/3202429
Comment #13
bluegeek9 commentedUnfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.