Drupal 5.9, Actions 5.x-2.5

While trying to use hook_mail_alter to provide some custom substitutions for an email action triggered "After a user account has been created" I found that the trigger is actually based on the insert user hook operation rather than after_insert which prevents any user profile or role data from being available to user triggered actions.

Not sure if this should be a bug or a feature request but the help text on the user trigger should probably be changed or the trigger should occur after_insert.

as a quick ugly hack I just did:

@@ -961,9 +961,10 @@
   // Keep objects for reuse so that changes actions make to objects can persist.
   static $objects;
   // We support a subset of operations.
-  if (!in_array($op, array('login', 'logout', 'insert', 'update', 'delete', 'view'))) {
+  if (!in_array($op, array('login', 'logout', 'after_insert', 'update', 'delete', 'view'))) {
     return;
   }
+  if ($op=='after_insert') $op = 'insert';
   $aids = _actions_get_hook_aids('user', $op);
   $context = array(
     'hook' => 'user',

obviously not a good long-term solution.

Comments

jvandyk’s picture

Status: Active » Closed (won't fix)

I've never heard of an 'after_insert' operation in core. It looks like it's specific to the User Register Redirect module.