You are here

function pcp_admin_settings_form_submit in Profile Complete Percent 6

Same name and namespace in other branches
  1. 5 pcp.module \pcp_admin_settings_form_submit()
  2. 6.2 pcp.module \pcp_admin_settings_form_submit()

Admin settings form submit

File

./pcp.module, line 143
Allows users with valid permissions to tag profile fields created from the profile module as required fields for a users profile to be considered complete.

Code

function pcp_admin_settings_form_submit($form, &$form_state) {
  if (is_array($form_state['values']['profile_fields']) && !empty($form_state['values']['profile_fields'])) {
    db_query("DELETE FROM {profile_pcp}");
    foreach ($form_state['values']['profile_fields'] as $fid) {
      if ($fid) {
        db_query("INSERT INTO {profile_pcp} VALUES (%d)", $fid);
      }
    }
    drupal_set_message("Your settings have been saved.");
  }
}