You are here

function twitter_update_7511 in Twitter 7.5

Same name and namespace in other branches
  1. 7.6 twitter.install \twitter_update_7511()

Add the new "administer twitter" permission to all roles that have the "administer site configuration" permission.

File

./twitter.install, line 606
Install, update and uninstall functions for the twitter module.

Code

function twitter_update_7511() {
  $roles = db_query("SELECT rid\n    FROM {role_permission}\n    WHERE permission = 'administer site configuration'")
    ->fetchCol();
  foreach ($roles as $rid) {
    $record = new StdClass();
    $record->rid = $rid;
    $record->permission = 'administer twitter';
    $record->module = 'twitter';
    drupal_write_record('role_permission', $record);
  }

  // Also reload the menus so the new permission is adopted.
  variable_set('menu_rebuild_needed', TRUE);
}