You are here

function user_badges_page_form in User Badges 5

Form to assign badges to users.

1 string reference to 'user_badges_page_form'
user_badges_page in ./user_badges.module
Define the page on user/uid/badges.

File

./user_badges.module, line 244
@brief User Badges module file

Code

function user_badges_page_form($account) {
  $form = array();
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $account->uid,
  );
  $form['badges'] = array(
    '#tree' => TRUE,
  );
  $badges = user_badges_get_badges('all');
  foreach ($badges as $badge) {
    $form['badges'][$badge->bid] = array(
      '#type' => 'checkbox',
      '#title' => theme('user_badge', $badge),
      '#return_value' => 1,
      '#default_value' => array_key_exists($badge->bid, $account->badges),
      '#description' => check_plain($badge->name),
    );
  }
  $form[] = array(
    '#type' => 'submit',
    '#value' => t('Save Badges'),
  );
  return $form;
}