You are here

function pcp_admin_settings_form_submit in Profile Complete Percent 6.2

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

Admin settings form submit

File

./pcp.module, line 230
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) {

  // Process the General Settings data
  variable_set('pcp_hide_block_on_complete', $form_state['values']['hide_block_on_complete']);
  variable_set('pcp_enable_user_picture', $form_state['values']['pcp_enable_user_picture']);
  variable_set('pcp_enabled_user_terms_vocabs', $form_state['values']['pcp_enabled_user_terms_vocabs']);

  // Process the profile fields that have been modified if available.
  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.");
  }
}