I need node_convert module to fire a trigger (any trigger - content updated, for instance) so i can perform other actions on node convert.

The best solution would be for the module include a event of its own, to use with rules - node is being converted, for example.

Comments

hlopes’s picture

Been messing around with this, so far this is what i have:

Line 625, node_convert.module

625    cache_clear_all('node/'. $nid, 'cache_menu', 'TRUE');
626 + $n = node_load($nid);
627 + $u = user_load($n->uid);
628 + if (module_exists('rules')) {
629 +   rules_invoke_event('converted_node',$n,$u);
630 + }
631   return $nid;

and at the end of the file

/* Adds event Node has been converted */

function node_convert_rules_event_info() {
  return array(
    'converted_node' => array(
      'label' => t('Node has been converted'),
      'module' => 'Node Convert',
      'arguments' => rules_events_node_arguments(t('saved content'), t("content's author"), TRUE),
    ),
  );
}

But apparently this approach doesn't work with Views bulk operations in Batch mode. But is worth a try for those who need to automate things on node conversion.

alcroito’s picture

Status: Active » Fixed

Thanks. Added into dev.

hlopes’s picture

For performance issues,

625    cache_clear_all('node/'. $nid, 'cache_menu', 'TRUE');
626 + if (module_exists('rules')) {
627 + $n = node_load($nid);
628 + $u = user_load($n->uid);
629 +   rules_invoke_event('converted_node',$n,$u);
630 + }
631   return $nid;

is better. Avoids node & user load if rules is not present.

alcroito’s picture

I took that into account.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.