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