I've been trying to get mailcomment working on Drupal 7.9. I get an email notification formatted by mailcomment when a comment is left for a particular node, but when I reply to an email and it is processed by mailcomment, I get a php error:
Recoverable fatal error: Argument 1 passed to mailcomment_source_get_source() must be an instance of FeedsImportBatch, instance of FeedsSource given, called in /drupal-7/sites/default/modules/feeds/plugins/FeedsProcessor.inc on line 386 and defined in mailcomment_source_get_source() (line 451 of /drupal-7/sites/default/modules/mailcomment/mailcomment.module).
Location http://drupal-7/batch?id=479&op=do
Referrer http://drupal-7/batch?op=start&id=479
I tracked down that mailcomment_source_get_source is expecting a FeedsImportBatch, and according to http://drupal.org/node/1180174
In Feeds 7.x-2.0, the FeedsBatch/FeedsImportBatch class is gone and is replaced with different "result" classes that are returned by Fetchers and Parsers. Instead of returning an object of class FeedsImportBatch, therefore, the Fetcher returns an object of type FeedsFetcherResult.
Here's the function declaration for mailcomment_source_get_source (which is set as a callback from mailcomment_feeds_parser_sources_alter):
function mailcomment_source_get_source(FeedsImportBatch $batch, $key) {
And here's taxonomy_feeds_get_source, (which is set as a callback from taxonomy_feeds_parser_sources_alter in modules/feeds/mappers/taxonomy.inc):
function taxonomy_feeds_get_source(FeedsSource $source, FeedsParserResult $result, $key) {
I changed mailcomment_source_get_source as follows, which fixed the error, but the comment reply email still isn't being processed.
function mailcomment_source_get_source(FeedsSource $batch, FeedsParserResult $result, $key) {
Still kind of stuck here, but I'm going to keep on it till I figure it out. If anyone can offer any help or advice it would be great. Maybe I'm doing something really wrong here!
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | mailcomment-1350072-3.patch | 958 bytes | pereljon |
Comments
Comment #0.0
pereljon commentedClarification in summary
Comment #1
pereljon commentedOk... Looks like I was mapping the result to the wrong argument. Here's the fixes I'm proposing.
1. Change the
mailcomment_source_get_sourcefunction comment to reflect the newhook_feeds_parser_sources_alter.2. Change the
mailcomment_source_get_sourcefunction arguments to($source, FeedsParserResult $result, $key).2a. Change the name of the "batch" argument variable to "result" to match
hook_feeds_parser_sources_alter.I'm going to package this into a patch and post it.
Cheers,
JP
Comment #2
pereljon commentedHere's the patch.
Comment #3
pereljon commentedMis-numbered the patch for comment 3. This comment's just filler.
Comment #4
danepowell commentedRight you are! Don't know how that slipped through testing. Thanks for the patch!
http://drupalcode.org/project/mailcomment.git/commit/d69a41a
Comment #5.0
(not verified) commentedAdded
tags