You are here

function user_badges_roles_form_submit in User Badges 6

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. 7 user_badges.admin.inc \user_badges_roles_form_submit()
  4. 7.2 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 556
@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.
    $value = $matches[1];
  }
  user_badges_save_roles($array);
}