You are here

function userpoints_confirm_approve in User Points 7.2

Same name and namespace in other branches
  1. 5.3 userpoints.module \userpoints_confirm_approve()
  2. 5.2 userpoints.module \userpoints_confirm_approve()
  3. 6 userpoints.module \userpoints_confirm_approve()
  4. 7 userpoints.admin.inc \userpoints_confirm_approve()
1 string reference to 'userpoints_confirm_approve'
userpoints_menu in ./userpoints.module
Implements hook_menu().

File

./userpoints.admin.inc, line 651
Admin menu callbacks for userpoints.module.

Code

function userpoints_confirm_approve($form, $form_state, $operation, $transaction) {
  $form = array(
    'txn_id' => array(
      '#type' => 'value',
      '#value' => $transaction->txn_id,
    ),
  );
  $arguments = array(
    '!user' => theme('username', array(
      'account' => $transaction->user,
    )),
    '%category' => $transaction->category,
  ) + userpoints_translation();
  if ($operation == 'approve') {
    $question = t('Approve transaction');
    $description = format_plural($transaction->points, 'Do you want to approve @count !point for !user in the %category category?', 'Do you want to approve @count !points for !user in the %category category?', $arguments);
    $form['operation'] = array(
      '#type' => 'value',
      '#value' => UserpointsTransaction::STATUS_APPROVED,
    );
  }
  else {
    $question = t('Decline transaction');
    $description = format_plural($transaction->points, 'Do you want to decline @count !point for !user in the %category category?', 'Do you want to decline @count !points for !user in the %category category?', $arguments);
    $form['operation'] = array(
      '#type' => 'value',
      '#value' => UserpointsTransaction::STATUS_DECLINED,
    );
  }
  $description = '<p><strong>' . $description . '</strong></p>';
  $description .= '<p>' . t('Reason: !reason', array(
    '!reason' => userpoints_create_description($transaction),
  )) . '</p>';
  return confirm_form($form, $question, 'admin/config/people/userpoints/moderate', $description);
}