/[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.12, Mon Mar 2 20:35:04 2009 UTC revision 1.16.2.13, Wed Jun 10 14:53:08 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  // $Id: referral.module,v 1.16.2.11 2008/12/03 17:08:27 kbahey Exp $  // $Id: referral.module,v 1.16.2.12 2009/03/02 20:35:04 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');
 define('REFERRAL_USERPOINTS',   'referral_userpoints');  
27  define('REFERRAL_GOTO_PATH',    'referral_goto_path');  define('REFERRAL_GOTO_PATH',    'referral_goto_path');
28    
29    
# Line 184  function _referral_user_save($uid) { Line 183  function _referral_user_save($uid) {
183      return;      return;
184    }    }
185    
   if (module_exists('userpoints')) {  
     $points = variable_get(REFERRAL_USERPOINTS, 1);  
     // Build the userpoints params array  
     $params = array(  
       'points'      => $points,  
       'uid'         => $cookie['uid'],  
       'operation'   => 'referral',  
       'entity_id'   => $cookie['uid'],  
       'entity_type' => 'user',  
       'reference'   => 'referral'  
     );  
   
     // Award the points to the user  
     userpoints_userpointsapi($params);  
   }  
   
186    // Invoke other modules hooks ...    // Invoke other modules hooks ...
187    module_invoke_all('referral', $uid, $cookie['uid']);    module_invoke_all('referral', $uid, $cookie['uid']);
188  }  }
# Line 573  function _referral_get_user_roles($uid) Line 556  function _referral_get_user_roles($uid)
556    }    }
557    return $data;    return $data;
558  }  }
   
 function referral_userpoints($op, $points = 0, $uid = 0, $event = '') {  
   switch($op) {  
     case 'setting':  
       $group = 'referral';  
       $form[$group] = array(  
         '#type' => 'fieldset',  
         '#collapsible' => TRUE,  
         '#collapsed' => TRUE,  
         '#title' => t('!Points for referral', userpoints_translation()),  
       );  
   
       $form[$group][REFERRAL_USERPOINTS] = array(  
         '#type' => 'textfield',  
         '#title' => t('!Points for referring a user', userpoints_translation()),  
         '#default_value' => variable_get(REFERRAL_USERPOINTS, 0),  
         '#size' => 5,  
         '#maxlength' => 5,  
       );  
       return $form;  
   }  
 }  
   

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

  ViewVC Help
Powered by ViewVC 1.1.2