You are here

function vppr_taxonomy_vocabulary_update in Vocabulary Permissions Per Role 7

Implements hook_taxonomy_vocabulary_update().

File

./vppr.module, line 107
Vocabulary Permissions Per Role

Code

function vppr_taxonomy_vocabulary_update($vocabulary) {
  if ($vocabulary->old_machine_name != $vocabulary->machine_name) {
    db_update('role_permission')
      ->fields(array(
      'permission' => 'administer ' . $vocabulary->machine_name . ' vocabulary terms',
    ))
      ->condition('permission', 'administer ' . $vocabulary->old_machine_name . ' vocabulary terms')
      ->execute();

    // Clear the user access cache.
    drupal_static_reset('user_access');
    drupal_static_reset('user_role_permissions');
  }
}