You are here

function rules_user_event_info in Rules 7.2

Implements hook_rules_event_info().

Related topics

File

modules/user.rules.inc, line 22
Rules integration for the user module.

Code

function rules_user_event_info() {
  return array(
    'user_insert' => array(
      'label' => t('After saving a new user account'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('registered user'),
        ),
      ),
      'access callback' => 'rules_user_integration_access',
    ),
    'user_update' => array(
      'label' => t('After updating an existing user account'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('updated user'),
        ),
        'account_unchanged' => array(
          'type' => 'user',
          'label' => t('unchanged user'),
          'handler' => 'rules_events_entity_unchanged',
        ),
      ),
      'access callback' => 'rules_user_integration_access',
    ),
    'user_presave' => array(
      'label' => t('Before saving a user account'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('saved user'),
          'skip save' => TRUE,
        ),
        'account_unchanged' => array(
          'type' => 'user',
          'label' => t('unchanged user'),
          'handler' => 'rules_events_entity_unchanged',
        ),
      ),
      'access callback' => 'rules_user_integration_access',
    ),
    'user_view' => array(
      'label' => t('User account page is viewed'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('viewed user'),
        ),
        'view_mode' => array(
          'type' => 'text',
          'label' => t('view mode'),
          'options list' => 'rules_get_entity_view_modes',
          // Add the entity-type for the options list callback.
          'options list entity type' => 'user',
        ),
      ),
      'access callback' => 'rules_user_integration_access',
      'help' => t("Note that if drupal's page cache is enabled, this event won't be generated for pages served from cache."),
    ),
    'user_delete' => array(
      'label' => t('After a user account has been deleted'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('deleted user'),
        ),
      ),
      'access callback' => 'rules_user_integration_access',
    ),
    'user_login' => array(
      'label' => t('User has logged in'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('logged in user'),
        ),
      ),
      'access callback' => 'rules_user_integration_access',
    ),
    'user_logout' => array(
      'label' => t('User has logged out'),
      'group' => t('User'),
      'variables' => array(
        'account' => array(
          'type' => 'user',
          'label' => t('logged out user'),
        ),
      ),
      'access callback' => 'rules_user_integration_access',
    ),
  );
}