You are here

function content_theme_update_6102 in Content Theme 7

Same name and namespace in other branches
  1. 6 content_theme.install \content_theme_update_6102()
  2. 7.2 content_theme.install \content_theme_update_6102()

Update content theme permissions.

File

./content_theme.install, line 99
Install, update and uninstall functions for the content_theme module.

Code

function content_theme_update_6102() {
  $perm = array();
  foreach (node_type_get_types() as $type => $value) {
    $perm[] = "select {$type} content editing theme";
    $perm[] = "select {$type} content viewing theme";
  }
  $result = db_query("SELECT * FROM {role_permission} WHERE permission = 'create content theme'");
  foreach ($result as $role_permission) {
    user_role_grant_permissions($role_permission->rid, $perm);
  }
  db_delete('role_permission')
    ->condition('permission', 'create content theme')
    ->execute();
}