You are here

function user_badges_userweight_form_submit in User Badges 6

Same name and namespace in other branches
  1. 6.2 user_badges.module \user_badges_userweight_form_submit()
  2. 7.4 user_badges.module \user_badges_userweight_form_submit()
  3. 7 user_badges.module \user_badges_userweight_form_submit()
  4. 7.2 user_badges.module \user_badges_userweight_form_submit()
  5. 7.3 user_badges.module \user_badges_userweight_form_submit()

Process user_badges_userweight_form form submissions.

Update the badge userweights

File

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

Code

function user_badges_userweight_form_submit($form, &$form_state) {
  if (isset($form['weight']) && is_array($form['weight'])) {
    foreach (element_children($form['weight']) as $bid) {
      db_query("UPDATE {user_badges_user} SET userweight = %d WHERE bid = %d AND uid = %d", $form_state['values'][$bid], $bid, $form_state['values']['uid']);
    }
    drupal_set_message(t('Your badge order has been updated.'));
  }
}