You are here

function secure_permissions_form_submit in Secure Permissions 7.2

Same name and namespace in other branches
  1. 6 secure_permissions.module \secure_permissions_form_submit()
  2. 7 secure_permissions.module \secure_permissions_form_submit()

We cannot rebuild the menu based on a setting during form submit, at least, not without special handling.

So set a session value to indicate we must rebuild the menus.

Also rebuilds permissions, if necessary.

1 string reference to 'secure_permissions_form_submit'
secure_permissions_form in ./secure_permissions.module
Configuration form for the module.

File

./secure_permissions.module, line 628
Secure Permissions module file.

Code

function secure_permissions_form_submit($form, &$form_state) {
  global $conf;
  $modules = module_implements('secure_permissions');
  $_SESSION['secure_permissions_rebuild'] = TRUE;
  if ($form_state['values']['secure_permissions_active'] && count($modules) > 1) {

    // We must do this to pass the value to the calling function during submit.
    $conf['secure_permissions_active'] = TRUE;
    $conf['secure_permissions_use_default'] = $form_state['values']['secure_permissions_use_default'];
    secure_permissions_rebuild();
  }
  else {
    drupal_set_message(t('Permissions cannot be rebuilt from code at this time.'));
  }
}