function userpoints_admin_txn_submit in User Points 6
Same name and namespace in other branches
- 5.3 userpoints.module \userpoints_admin_txn_submit()
- 5 userpoints.module \userpoints_admin_txn_submit()
- 5.2 userpoints.module \userpoints_admin_txn_submit()
- 7.2 userpoints.admin.inc \userpoints_admin_txn_submit()
- 7 userpoints.admin.inc \userpoints_admin_txn_submit()
File
- ./
userpoints.module, line 1270
Code
function userpoints_admin_txn_submit($form, &$form_state) {
if ($form_state['values']['form_id'] != 'userpoints_admin_txn') {
return;
}
$txn_user = user_load(array(
'name' => $form_state['values']['txn_user'],
));
switch ($form_state['values']['mode']) {
case 'add':
$params = array(
'points' => $form_state['values']['points'],
'uid' => $txn_user->uid,
'operation' => 'admin',
'description' => $form_state['values']['description'],
'reference' => $form_state['values']['reference'],
'tid' => $form_state['values']['tid'],
'time_stamp' => strtotime($form_state['values']['time_stamp']),
);
if ($form_state['values']['expirydate']) {
//Check for the existence of an expirydate
$params['expirydate'] = strtotime($form_state['values']['expirydate']);
}
userpoints_userpointsapi($params);
break;
case 'edit':
if ($form_state['values']['expirydate']) {
$expirydate = strtotime($form_state['values']['expirydate']);
}
$params = array(
'uid' => $form_state['values']['txn_uid'],
'approver_id' => $form_state['values']['approver_uid'],
'points' => $form_state['values']['points'],
'time_stamp' => strtotime($form_state['values']['time_stamp']),
'operation' => $form_state['values']['operation'],
'description' => $form_state['values']['description'],
'reference' => $form_state['values']['reference'],
'status' => $form_state['values']['status'],
'expirydate' => $expirydate,
'txn_id' => $form_state['values']['txn_id'],
);
userpoints_userpointsapi($params);
}
$form_state['redirect'] = 'admin/user/userpoints';
}