1 comment.install comment_update_1007()

Give access to the new 'Administer comment settings' permission as needed.

Related topics

File

core/modules/comment/comment.install, line 460
Install, update and uninstall functions for the Comment module.

Code

function comment_update_1007() {
  $names = config_get_names_with_prefix('user.role.');
  foreach ($names as $config_name) {
    $config = config($config_name);
    $permissions = $config->get('permissions');
    if (in_array('administer comments', $permissions)) {
      $permissions[] = 'administer comment settings';
      $config->set('permissions', $permissions);
      $config->save();
    }
  }
}