anru
anru

Reputation: 1414

Changes to the User Permissions Not saving

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.

Upvotes: 2

Views: 2178

Answers (4)

Cristian Mamani
Cristian Mamani

Reputation: 101

There is a good explanation of the issue that you are having here: http://2bits.com/drupal/drupal-not-saving-admin-pages-large-number-input-fields.html

Upvotes: 4

joedivic
joedivic

Reputation: 141

You need to adjust the max_input_vars in php.ini. The usual default is 1000, but with a lot of modules, the Drupal permissions page easily eclipses this. Just add another zero and make it 10000 if you have access to php.ini and restart apache. The location of the php.ini file depends on your server configuration.

I had the same issue, with no errors in the error log, and this fixed it for me.

Upvotes: 4

avpaderno
avpaderno

Reputation: 29699

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();
}

Upvotes: 0

Kevin
Kevin

Reputation: 13226

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

Upvotes: 1

Related Questions