/[drupal]/contributions/modules/referral/referral.module
ViewVC logotype

Diff of /contributions/modules/referral/referral.module

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

revision 1.16.2.11, Wed Dec 3 17:08:27 2008 UTC revision 1.16.2.12, Mon Mar 2 20:35:04 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  // $Id: referral.module,v 1.16.2.10 2008/12/01 01:43:33 kbahey Exp $  // $Id: referral.module,v 1.16.2.11 2008/12/03 17:08:27 kbahey Exp $
4    
5  /**  /**
6   * @file   * @file
# Line 24  define('REFERRAL_HEX_START', 7); Line 24  define('REFERRAL_HEX_START', 7);
24  define('REFERRAL_HEX_LENGTH',   4);  define('REFERRAL_HEX_LENGTH',   4);
25  define('REFERRAL_DISPLAY_MODE', 'referral_display_mode');  define('REFERRAL_DISPLAY_MODE', 'referral_display_mode');
26  define('REFERRAL_COOKIE',       'referral_data');  define('REFERRAL_COOKIE',       'referral_data');
27    define('REFERRAL_USERPOINTS',   'referral_userpoints');
28  define('REFERRAL_GOTO_PATH',    'referral_goto_path');  define('REFERRAL_GOTO_PATH',    'referral_goto_path');
29    
30    
# Line 183  function _referral_user_save($uid) { Line 184  function _referral_user_save($uid) {
184      return;      return;
185    }    }
186    
187      if (module_exists('userpoints')) {
188        $points = variable_get(REFERRAL_USERPOINTS, 1);
189        // Build the userpoints params array
190        $params = array(
191          'points'      => $points,
192          'uid'         => $cookie['uid'],
193          'operation'   => 'referral',
194          'entity_id'   => $cookie['uid'],
195          'entity_type' => 'user',
196          'reference'   => 'referral'
197        );
198    
199        // Award the points to the user
200        userpoints_userpointsapi($params);
201      }
202    
203    // Invoke other modules hooks ...    // Invoke other modules hooks ...
204    module_invoke_all('referral', $uid, $cookie['uid']);    module_invoke_all('referral', $uid, $cookie['uid']);
205  }  }
# Line 557  function _referral_get_user_roles($uid) Line 574  function _referral_get_user_roles($uid)
574    return $data;    return $data;
575  }  }
576    
577    function referral_userpoints($op, $points = 0, $uid = 0, $event = '') {
578      switch($op) {
579        case 'setting':
580          $group = 'referral';
581          $form[$group] = array(
582            '#type' => 'fieldset',
583            '#collapsible' => TRUE,
584            '#collapsed' => TRUE,
585            '#title' => t('!Points for referral', userpoints_translation()),
586          );
587    
588          $form[$group][REFERRAL_USERPOINTS] = array(
589            '#type' => 'textfield',
590            '#title' => t('!Points for referring a user', userpoints_translation()),
591            '#default_value' => variable_get(REFERRAL_USERPOINTS, 0),
592            '#size' => 5,
593            '#maxlength' => 5,
594          );
595          return $form;
596      }
597    }
598    

Legend:
Removed from v.1.16.2.11  
changed lines
  Added in v.1.16.2.12

  ViewVC Help
Powered by ViewVC 1.1.2