You are here

function userpoints_rules_rules_action_info in User Points 7

Same name and namespace in other branches
  1. 7.2 userpoints_rules/userpoints_rules.rules.inc \userpoints_rules_rules_action_info()

Implements hook_rules_action_info().

File

./userpoints_rules.rules.inc, line 11
Provide better integration into the rules group

Code

function userpoints_rules_rules_action_info() {
  return array(
    'userpoints_action_grant_points' => array(
      'label' => t('Grant !points to a user', userpoints_translation()),
      'named parameter' => TRUE,
      'parameter' => array(
        'user' => array(
          'type' => 'user',
          'label' => t('User'),
          'description' => t('The user that will receive the !points', userpoints_translation()),
        ),
        'points' => array(
          'type' => 'integer',
          'label' => t('!Points', userpoints_translation()),
          'description' => t('Amount of !points to give or take.', userpoints_translation()),
        ),
        'tid' => array(
          'label' => t('!Points category', userpoints_translation()),
          'type' => 'integer',
          'options list' => 'userpoints_rules_get_categories',
        ),
        'entity' => array(
          'label' => t('Entity'),
          'type' => 'entity',
          'description' => t('The entity to which this transaction refers.'),
          'optional' => TRUE,
        ),
        'description' => array(
          'label' => t('Description'),
          'type' => 'text',
          'description' => t('Can contain the reason why the points have been granted.'),
          'restriction' => 'input',
          'optional' => TRUE,
        ),
        'operation' => array(
          'label' => t('Operation'),
          'type' => 'text',
          'description' => t('Describes the operation (Insert/Remove/...).'),
          'restriction' => 'input',
        ),
        'reference' => array(
          'label' => t('Reference'),
          'type' => 'text',
          'description' => t('Can contain a reference for this transaction.'),
          'optional' => TRUE,
        ),
        'display' => array(
          'label' => t('Display'),
          'type' => 'boolean',
          'description' => t('Whether or not to show a message to the user when this !points transaction is added.', userpoints_translation()),
          'default value' => TRUE,
        ),
        'moderate' => array(
          'label' => t('Moderate'),
          'type' => 'text',
          'description' => t('Whether or not this !points transaction should be moderated.', userpoints_translation()),
          'options list' => 'userpoints_rules_moderate',
        ),
        'expirydate' => array(
          'label' => t('Expiration Date'),
          'type' => 'date',
          'description' => t('Define when the !points should expire.', userpoints_translation()),
          'optional' => TRUE,
        ),
      ),
      'group' => t('!Points', userpoints_translation()),
    ),
    'userpoints_rules_get_current_points' => array(
      'label' => t('Load !points of a user', userpoints_translation()),
      'parameter' => array(
        'user' => array(
          'type' => 'user',
          'label' => t('User'),
          'description' => t('The user that will receive the !points', userpoints_translation()),
        ),
        'tid' => array(
          'label' => t('!Points category', userpoints_translation()),
          'type' => 'text',
          'options list' => 'userpoints_rules_get_all_categories',
        ),
      ),
      'new variables' => array(
        'loaded_points' => array(
          'type' => 'integer',
          'label' => t('Number of !points in the specified category.', userpoints_translation()),
        ),
      ),
      'group' => t('!Points', userpoints_translation()),
    ),
  );
}