It would be great if Subuser could have some Rule triggers, like when a subuser account is created or if an account is deleted.
It would be great if Subuser could have some Rule triggers, like when a subuser account is created or if an account is deleted.
Comments
Comment #1
mlalu commentedI am very, very new to php so here is my first stab at an event rule. I created a new file called "subuser.rules.inc" and added this:
I then added this to the subuser.pages.inc file at line 300:
Comment #2
scalp commentedThank you for this. I had to change the call to rules_invoke_event a little to get it to work. The line number isn't going to stay consistent through versions so I added it in the function subuser_create_form_submit($form, &$form_state) right after the following line:
watchdog('user', 'New user: %name (%email).', array('%name' => $name, '%email' => $mail), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
I left the variables as named _uid, but to be more precise you should probably remove that since it's not really giving a uid. You'd need to change them in the function subuser_rules_event_info() as well if you did that.
Comment #3
mlalu commentedGreat idea. Thanks for the feedback.