You are here

function userpoints_admin_txn_submit in User Points 5.2

Same name and namespace in other branches
  1. 5.3 userpoints.module \userpoints_admin_txn_submit()
  2. 5 userpoints.module \userpoints_admin_txn_submit()
  3. 6 userpoints.module \userpoints_admin_txn_submit()
  4. 7.2 userpoints.admin.inc \userpoints_admin_txn_submit()
  5. 7 userpoints.admin.inc \userpoints_admin_txn_submit()

File

./userpoints.module, line 611

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':
      userpoints_userpointsapi('points', $form['points'], $txn_user->uid, 'admin', $form['description'], $form['reference']);
      break;
    case 'edit':
      db_query("UPDATE {userpoints_txn} \n        SET uid = %d, approver_uid = %d, points = %d, time_stamp = %d, event = '%s', description = '%s', reference = '%s', status = %d WHERE txn_id = %d", $form['uid'], $form['approver_uid'], $form['points'], strtotime($form['time_stamp']), $form['event'], $form['description'], $form['reference'], $form['status'], $form['txn_id']);
      drupal_set_message(t('Transaction has been updated.'));
  }
  drupal_goto('admin/user/userpoints');
}