/[drupal]/contributions/modules/userpoints/userpoints_rules.module
ViewVC logotype

Contents of /contributions/modules/userpoints/userpoints_rules.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Dec 1 18:33:49 2008 UTC (11 months, 3 weeks ago) by kbahey
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
#312364 by andru, pebosi: Replace Workflow-NG with Rules for 6.x.
1 <?php
2 // $Id:
3
4 /**
5 * @file
6 * Some rules integration for the user points module
7 */
8
9 /**
10 * Rules hook implementation.
11 */
12 function userpoints_rules_action_info() {
13 $actions = array();
14 $actions['userpoints_action_grant_points'] = array(
15 'label' => t('Grant points to a user'),
16 'arguments' => array(
17 'user' => array('type' => 'user','label' => t('User') )
18 ),
19 'module' => 'Userpoints',
20 'eval input' => array('points')
21 );
22 return $actions;
23 }
24
25 /**
26 * Rules action - grant points to a user
27 */
28 function userpoints_action_grant_points($user,$settings){
29 userpoints_userpointsapi(array('uid' => $user->uid, 'points' => $settings['points']));
30 }
31
32 /**
33 * Rules form configuration - allow number of points to be set by the rule
34 */
35 function userpoints_action_grant_points_form($settings = array(), &$form) {
36
37 $form['settings']['points'] = array(
38 '#type' => 'textfield',
39 '#title' => t('Number of points'),
40 '#default_value' => isset($settings['points']) ? $settings['points'] : '',
41 '#description' => t('The number of points to award')
42 );
43 }

  ViewVC Help
Powered by ViewVC 1.1.2