I got mailhandler to create nodes with taxonomy terms. However, the problem is that it's not create forum topics correctly. Below you will see the export of my Feed Importer. To test, I sent an email and did the import. The forum node got created with the correct Taxonomy but it doesn't show up on the forum because it didn't create an entry in the drupal's forum table. If I edit the node and save it then it add an entry to the table and the forum topic shows up. I tried with the latest release version and the dev version and neither worked. Any suggestions? Thank you

-Andre

$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'mailhandler_nodes';
$feeds_importer->config = array(
  'name' => 'Forum',
  'description' => '',
  'fetcher' => array(
    'plugin_key' => 'MailhandlerFetcher',
    'config' => array(
      'filter' => 'MailhandlerFiltersNodes',
    ),
  ),
  'parser' => array(
    'plugin_key' => 'MailhandlerParser',
    'config' => array(
      'default_commands' => 'status: 0
taxonomy: [Main]
type: forum
tid: 1',
      'commands_failed_auth' => 'status: 0
taxonomy: [Main]
type: forum
tid: 1',
      'available_commands' => 'status
taxonomy
type
tid',
      'command_plugin' => array(
        'MailhandlerCommandsHeaders' => 'MailhandlerCommandsHeaders',
        'MailhandlerCommandsDefault' => 'MailhandlerCommandsDefault',
        'MailhandlerCommandsFiles' => 'MailhandlerCommandsFiles',
      ),
      'authenticate_plugin' => 'MailhandlerAuthenticateDefault',
    ),
  ),
  'processor' => array(
    'plugin_key' => 'FeedsNodeProcessor',
    'config' => array(
      'content_type' => 'forum',
      'input_format' => '4',
      'update_existing' => '0',
      'expire' => '-1',
      'mappings' => array(
        0 => array(
          'source' => 'subject',
          'target' => 'title',
          'unique' => FALSE,
        ),
        1 => array(
          'source' => 'body_text',
          'target' => 'body',
          'unique' => FALSE,
        ),
        2 => array(
          'source' => 'authenticated_uid',
          'target' => 'uid',
          'unique' => FALSE,
        ),
        3 => array(
          'source' => 'status',
          'target' => 'status',
          'unique' => FALSE,
        ),
        4 => array(
          'source' => 'taxonomy',
          'target' => 'taxonomy:1',
          'unique' => FALSE,
        ),
      ),
      'author' => 0,
      'authorize' => 1,
    ),
  ),
  'content_type' => '',
  'update' => 0,
  'import_period' => '900',
  'expire_period' => 3600,
  'import_on_create' => 1,
);

Comments

asilva1312’s picture

Issue summary: View changes

formatted for code.

asilva1312’s picture

Any thoughts anyone?

asilva1312’s picture

bump

asilva1312’s picture

Since there was no immediate solution, I wrote a quick custom module as a work around. Here is the code. Hope it helps someone.

custom.module file

	
function custom_nodeapi(&$node, $op, $teaser, $page) {
	if($node->type == 'forum' && $op == 'insert' && (arg(0) != 'node'))
	{

		$tax = $node->taxonomy[1];

		$id = db_result(db_query('SELECT COUNT(tid) FROM {forum} WHERE nid = %d', $node->nid));
		if($id == 0)
		{
			db_query('INSERT INTO {forum} (nid, vid, tid) VALUES (%d, %d, %d)', $node->nid, $node->vid, $tax->tid);
      
		}

	}
	
}

custom.info file

; $Id$
name = Custom Site functions
description = Custom functions for this site.
core = 6.x

You can place the above 2 files in a folder called custom and upload it into your module folder and activate it.

danepowell’s picture

No need to bump, I saw this issue when you first posted it- I'm just extraordinarily busy with other projects at the moment and don't have the bandwidth to handle this issue. I'll get around to it when I can.

danepowell’s picture

Priority: Critical » Major
Status: Active » Postponed

This is really a more general problem with Feeds, which Mailhandler relies upon. Please see #818812: Assign feed items to a specific forum.

As you discovered, you will need to write a custom module to solve this, or re-open that issue in the Feeds queue. If writing a separate module, I would recommend using hooks provided by the Feeds module to act after the node processor runs, rather than using hook_nodeapi().

danepowell’s picture

Status: Postponed » Closed (duplicate)
danepowell’s picture

Issue summary: View changes

formatted for php