The implementation of hook_action_info() in version 7.x-1.3 of this module looks like it is using the Drupal 6 API when returning its structured array.

  $actions['custom_pub_on_action'] = array(
    'label' => 'Toggle a Custom Publishing Option on',
    'type' => 'node',
    'description' => t('Toggle a Custom Publishing Option on'),
    'configurable' => TRUE,
    'behavior' => array('changes_node_property'),
    'hooks' => array(
      'nodeapi' => array('presave'),
      'comment' => array('insert', 'update'),
    ),
  );

Based on the documentation for D7 API here:
https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...

the 'hooks' attribute from D6 API doesn't exist anymore. Also, the only valid value for 'behavior' is 'changes_property', not 'changes_node_property'. I think the correct version should look something like

  $actions['custom_pub_on_action'] = array(
    'label' => 'Toggle a Custom Publishing Option on',
    'type' => 'node',
    'description' => t('Toggle a Custom Publishing Option on'),
    'configurable' => TRUE,
    'triggers' => array('node_presave', 'comment_insert', 'comment_update'),
    'behavior' => array('changes_property'),
    ),
  );

My guess is this might also have something to do with why node_save() is having to be manually called in the custom_pub_on_action() and custom_pub_off_action() functions. If the 'changes_property' were there, I think node_save() would get called after your action function returned. I'm basing that on this note in the hook_action_info() documentation:

If an action with this behavior is assigned to a trigger other than a "presave" hook, any save actions also assigned to this trigger are moved later in the list. If no save action is present, one will be added.

I will work on a patch in the next couple of days to test this.

CommentFileSizeAuthor
#1 patch.diff2.66 KBajm8372

Comments

ajm8372’s picture

StatusFileSize
new2.66 KB

Attached a patch that seems to work as described above. I updated hook_action_info() to use the D7 API, and removed the redundant call to node_save() in the custom_pub_on_action() and custom_pub_off_action() functions.

kevinquillen’s picture

Assigned: Unassigned » kevinquillen
dbazuin’s picture

I can confirm that this patch works.

  • VladimirAus committed 1d40ae0 on 7.x-1.x authored by ajm8372
    Issue #2074757 by ajm8372, dbazuin, VladimirAus: hook_action_info()...
vladimiraus’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Assigned: kevinquillen » Unassigned
Status: Active » Fixed

Rerolled patch.
Thanks everyone.

Status: Fixed » Closed (fixed)

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