views:

44

answers:

2

I am use drupal 6.

it seems like permission page can not save too many settings.

I have try to save permission setting, but it is just not saved into DB. I have found out this is due to "too many fields". (use content permission module). if i uncheck some fields, and then checking lesser fields, permission will be saved.

for example, if I am unchecking 2 check boxes, then checking one check box, permission will be saved.

does any one know which function the permission page used to insert result into db?

my php memory limit is 256M.

A: 

Change the size of the db table? Sounds like its truncating.

Kevin
how to do that? by the way , i have dumped out whole permission table, it only 16090 byte, and where can i check a table size. my db is mysql
anru
Change its type to long text with a database client like mysql in ssh or HeidiSQL gui
Kevin
drupal's default type is longtype for permission type.
anru
A: 

The function that saves the permissions in the database is user_admin_perm_submit().

function user_admin_perm_submit($form, &$form_state) {
  // Save permissions:
  $result = db_query('SELECT * FROM {role}');
  while ($role = db_fetch_object($result)) {
    if (isset($form_state['values'][$role->rid])) {
      // Delete, so if we clear every checkbox we reset that role;
      // otherwise permissions are active and denied everywhere.
      db_query('DELETE FROM {permission} WHERE rid = %d', $role->rid);
      $form_state['values'][$role->rid] = array_filter($form_state['values'][$role->rid]);
      if (count($form_state['values'][$role->rid])) {
        db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($form_state['values'][$role->rid])));
      }
    }
  }

  drupal_set_message(t('The changes have been saved.'));

  // Clear the cached pages
  cache_clear_all();
}
kiamlaluno

related questions