I am trying to set up a rule that triggers when a user has changed a role - however it does not seem to work.

The following is an export of that rule:

--------------------------------------------------------
array (
'cfg_3' =>
array (
'#weight' => '0',
'#type' => 'configuration',
'#altered' => false,
'#event' => 'user_update',
'#id' => 1,
'#module' => 'workflow-ng',
'#label' => 'User has changed role',
'#active' => 1,
0 =>
array (
'#id' => 2,
'#label' => 'Unchanged Role Pre-authenticated',
'#type' => 'condition',
'#name' => 'workflow_ng_condition_user_hasrole',
'#settings' =>
array (
'roles' =>
array (
0 => 9,
),
'operation' => 'AND',
),
'#argument map' =>
array (
'account_unchanged' => 'user',
),
),
1 =>
array (
'#name' => 'workflow_ng_condition_user_hasrole',
'#label' => 'Current Role is Authenticated User',
'#id' => 3,
'#type' => 'condition',
'#argument map' =>
array (
'account' => 'user',
),
'#settings' =>
array (
'roles' =>
array (
0 => 2,
),
'operation' => 'OR',
),
),
2 =>
array (
'#id' => 4,
'#type' => 'action',
'#label' => 'Send a welcome email to authenticated user',
'#name' => 'workflow_ng_action_mail_to_user',
'#settings' =>
array (
'from' => 'info@shenzhenparty.com',
'from_args' =>
array (
),
'subject' => 'Thank you for Activating your Account at Shenzhenparty.com',
'subject_args' =>
array (
),
'message' => 'Hi [account:user],

Thank you for activating your account at Shenzhenparty.com.

All the best,

',
'message_args' =>
array (
0 => 'account',
),
),
'#argument map' =>
array (
'account' => 'user',
),
),
3 =>
array (
'#type' => 'action',
'#name' => 'workflow_ng_action_watchdog',
'#settings' =>
array (
'severity' => '0',
'type' => 'workflow-ng',
'message' => '[account:user] has authenticated his account',
'message_args' =>
array (
0 => 'account',
),
'link' => '',
'link_args' =>
array (
),
),
),
'#name' => 'cfg_3',
),
)

-----------------------------------------

- Preuthenticated is the role when users register to the site
- after authenticating their email address, the role is changed (by Logintoboggan) into Authenticated
- it supposed to send an email to the user to thank the user for authenticating their email address
- email works - I have other rules setup that sends an email after some event and I am receiving the emails
- seems to be a problem with setting up the rules/conditions

What did I miss?

Setup is Drupal 5.8
Workflow-ng 5.x-2.1
LoginToboggan 5.x-1.3

Apache2

Thanks

Comments

khan2ims’s picture

Hi,

I too am facing problem in trigeering an event each time, the admin change the user role.

Anybody, plz guide us!!

fago’s picture

please check which condition fails, which you don't expect.. You can test the conditions, by putting them in a separate role and doing a drupal_set_message or so, when they are met. Or just enable the debug log, which you can do by changing the define at the top of the module.