You are here

function nodeaccess_save_role_aliases in Nodeaccess 6

Same name and namespace in other branches
  1. 5 nodeaccess.module \nodeaccess_save_role_aliases()
  2. 6.2 nodeaccess.module \nodeaccess_save_role_aliases()
  3. 7 nodeaccess.module \nodeaccess_save_role_aliases()
1 call to nodeaccess_save_role_aliases()
nodeaccess_admin_form_submit in ./nodeaccess.module
Submit function for nodeaccess_admin_form.

File

./nodeaccess.module, line 833

Code

function nodeaccess_save_role_aliases($edit) {
  db_query('DELETE FROM {nodeaccess_role_alias}');
  $success = TRUE;
  if (is_array($edit)) {
    foreach ($edit as $key => $value) {
      $success = $success && db_query("INSERT INTO {nodeaccess_role_alias} (rid, name, weight) VALUES (%d, '%s', %d)", $key, $value['name'], $value['weight']);
    }
  }
  if (!$success) {
    drupal_set_message(t("There was a problem saving to the database"));
  }
  return $success;
}