/** * Rules action - grant points to a user */ function userpoints_action_grant_points($user,$settings){ userpoints_userpointsapi(array('uid' => $user->uid, 'points' => $settings['points'], 'operation' => $settings['operation'], 'entity_type' => $settings['entity_type'], 'tid' => $settings['points_category'], )); } /** * Rules form configuration - allow number of points to be set by the rule */ function userpoints_action_grant_points_form($settings = array(), &$form) { $form['settings']['points'] = array( '#type' => 'textfield', '#title' => t('Number of points'), '#default_value' => isset($settings['points']) ? $settings['points'] : '', '#description' => t('The number of points to award') ); $form['settings']['points_category'] = array( '#type' => 'select', '#title' => t('Category'), '#default_value' => isset($settings['points_category']) ? $settings['points_category'] : 0, '#options' => userpoints_get_categories(), '#description' => t('Points will be assigned to this category. You can modify what categories are available by modifying the Userpoints taxonomy.', array('!url' => url('admin/content/taxonomy/'. variable_get(USERPOINTS_CATEGORY_DEFAULT_VID, '')))), ); $form['settings']['operation'] = array( '#type' => 'textfield', '#title' => t('Operation'), '#default_value' => isset($settings['operation']) ? $settings['operation'] : '', '#description' => t('The operation, which the user will be displayed for transaction (eg. "node view")') ); $form['settings']['entity_type'] = array( '#type' => 'textfield', '#title' => t('Entity Type'), '#default_value' => isset($settings['entity_type']) ? $settings['entity_type'] : '', '#description' => t('The entity_type, which will be stored on transaction level (eg. "node")') ); }