diff --git a/masquerade_ctools/masquerade_ctools.module b/masquerade_ctools/masquerade_ctools.module index a4ef1ac..337af2e 100644 --- a/masquerade_ctools/masquerade_ctools.module +++ b/masquerade_ctools/masquerade_ctools.module @@ -78,3 +78,33 @@ function masquerade_ctools_is_being_masqueraded($account) { $result = $query->fetchCol(); return !empty($result); } + +/** + * Function implements hook_rules_action_info(). + */ +function masquerade_ctools_rules_event_info() { + $items = array( + 'is_masquerading' => array( + 'label' => t('Is the user masquerading'), + 'group' => t('Masquerade'), + 'variables' => array( + 'user' => array( + 'type' => 'user', + 'label' => t('Current user'), + ), + ), + ), + ); + return $items; +} + + +/** + * Implements hook_init(). + */ +function masquerade_ctools_init() { + global $user; + if (masquerade_ctools_is_masquerading($user)) { + rules_invoke_event('is_masquerading', $user); + } +}