You are here

function user_badges_roles_form_submit in User Badges 7.2

Same name and namespace in other branches
  1. 5 user_badges.module \user_badges_roles_form_submit()
  2. 6.2 user_badges.admin.inc \user_badges_roles_form_submit()
  3. 6 user_badges.admin.inc \user_badges_roles_form_submit()
  4. 7 user_badges.admin.inc \user_badges_roles_form_submit()
  5. 7.3 user_badges.admin.inc \user_badges_roles_form_submit()

Submission function for user_badges_roles_form.

File

./user_badges.admin.inc, line 689
@brief User Badges admin functions

Code

function user_badges_roles_form_submit($form, &$form_state) {
  $array = $form_state['values']['roles'] + $form_state['values']['blocked'];
  foreach ($array as $field => &$value) {

    // We now have a string as our badge, so just extract the bid.
    preg_match('/\\(' . t('Badge ID') . ' (\\d+)\\)/', $value, $matches);

    // Transform our value into just the bid.
    if (!empty($matches)) {
      $value = $matches[1];
    }
  }
  user_badges_save_roles($array);
}