I have a custom Action inside a module I built called "bocumod":


function bocumod_action_info() {
  return array(
    'bocumod_email24hrsbefore_action' => array(
      'description' => t('Email 24hrs Before Event Action'),
      'type' => 'node',
      'configurable' => FALSE,
      'hooks' => array(
        'hooks' => array('any' => TRUE),
        ),
      ),
  );
}

function bocumod_email24hrsbefore_action(&$object, $context = array()) {
    watchdog("Custom Action", "This Action is working correctly");
}

I am trying to use Rules Scheduling to call this Action. I have tested it and it all works fine (by manually running cron once the thing is scheduled) but it will not run when I let my hosting cron run. I know the scheduling is working because I set a watchdog inside of the rule set right after the Action and it got logged when cron ran. But the Action did not evaluate.

Would there be some reason an Action won't get called if it's ran by an anonymous cron by the server? I can't see any other reason why this wouldn't work.

Thanks!

Tom

Comments

Rilla Creative’s picture

Nevermind.

mjstone323’s picture

Could you please post what your solution was? I am having a similar problem trying to send an email out based on a CCK "to" date field.

bacon’s picture

What are you trying to do? I was able to do what I needed to do by implementing a couple of hooks.

fast women, pretty cars, sexy computers
https://coderwall.com/algorgeous/

bacon’s picture

I'm trying to do something similar to what you are doing. I want to schedule a reminder email to be sent 48 hours after a new "agreement" node is created to remind the author to approve the node. I used the Rules UI to create the rule set and the triggered rule. If I make my new node by going to node/add/agreement then the rule gets triggered correctly and the email is scheduled. If the node is created in my module code, then the rule doesn't seem to get triggered.

So I'm thinking that I can't mix module code and using the Rules UI to achieve this. I'm going to try using the hooks and doing everything in code. Is this what you have found?

Did you have to call rules_invoke_event to get the rule to be triggered?

I may have questions for you later, but I kind of wanted to reply to this topic so I can track it in my recent posts list.

fast women, pretty cars, sexy computers
https://coderwall.com/algorgeous/