You are here

regcode.rules.inc in Registration codes 7.2

Same filename and directory in other branches
  1. 6.2 regcode.rules.inc
  2. 6 regcode.rules.inc
  3. 7 regcode.rules.inc

Rules integration for the regcode module.

File

regcode.rules.inc
View source
<?php

/**
 * @file
 * Rules integration for the regcode module.
 */

/**
 * Implements hook_rules_event_info().
 *
 * @ingroup rules
 */
function regcode_rules_event_info() {
  return array(
    'regcode_used' => array(
      'label' => t('User has used a registration code'),
      'group' => 'Regcode',
      'variables' => array(
        'user' => array(
          'type' => 'user',
          'label' => t('The user using the code'),
        ),
        'regcode' => array(
          'type' => 'regcode',
          'label' => t('The regcode which was used'),
        ),
      ),
    ),
  );
}

/**
 * Implements hook_rules_condition_info().
 *
 * @ingroup rules
 */
function regcode_rules_condition_info() {
  return array(
    'regcode_rules_condition_regcode_available' => array(
      'label' => t('User has used a Registration Code'),
      'module' => 'regcode',
      'group' => t('Regcode'),
      'arguments' => array(
        'user' => array(
          'type' => 'user',
          'label' => t('The user account being registered'),
        ),
      ),
    ),
  );
}

/**
 * Implements the condition regcode_rules_condition_regcode_available.
 */
function regcode_rules_condition_regcode_available(stdClass $account = NULL) {
  return !empty($account->regcode);
}

Functions

Namesort descending Description
regcode_rules_condition_info Implements hook_rules_condition_info().
regcode_rules_condition_regcode_available Implements the condition regcode_rules_condition_regcode_available.
regcode_rules_event_info Implements hook_rules_event_info().