You are here

function twitter_post_update_7500 in Twitter 7.5

Same name and namespace in other branches
  1. 7.6 twitter_post/twitter_post.install \twitter_post_update_7500()

Add the new "post to twitter with global account" permission to all roles that have the "post to twitter" permission.

File

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

Code

function twitter_post_update_7500() {
  $roles = db_query("SELECT rid\n    FROM {role_permission}\n    WHERE permission = 'post to twitter'")
    ->fetchCol();
  foreach ($roles as $rid) {
    $record = new StdClass();
    $record->rid = $rid;
    $record->permission = 'post to twitter with global account';
    $record->module = 'twitter';
    drupal_write_record('role_permission', $record);
  }
  drupal_set_message(t('A new permission "Post a message to Twitter using a global account" as been added to all roles that already had the "Post a message to Twitter" permission. It is recommended to <a href="@url">review the permissions</a> to ensure they are appropriate for this site\'s needs.', array(
    '@url' => url('admin/people/permissions'),
  )));
}