function simple_access_profile_form_submit in Simple Access 7.2
Same name and namespace in other branches
- 5.2 simple_access.module \simple_access_profile_form_submit()
- 6.2 simple_access.admin.inc \simple_access_profile_form_submit()
Profile form submit callback.
File
- ./
simple_access.admin.inc, line 237 - House all the admin functions in inc to make the foot print a lot smaller.
Code
function simple_access_profile_form_submit($form, &$form_state) {
if (!empty($form_state['values']['pid'])) {
drupal_write_record('simple_access_profiles', $form_state['values'], array(
'pid',
));
}
else {
drupal_write_record('simple_access_profiles', $form_state['values']);
}
db_delete('simple_access_profiles_access')
->condition('pid', $form_state['values']['pid'])
->execute();
if (isset($form_state['values']['access'])) {
foreach ($form_state['values']['access'] as $gid => $access) {
if ($access['sa_view'] || $access['sa_update'] || $access['sa_delete']) {
$access['pid'] = $form_state['values']['pid'];
$access['gid'] = $gid;
drupal_write_record('simple_access_profiles_access', $access);
}
}
}
$form_state['redirect'] = 'admin/config/content/simple-access/profiles';
}