You are here

function google_tag_update_7101 in GoogleTagManager 7

Same name and namespace in other branches
  1. 7.2 google_tag.install \google_tag_update_7101()

Convert values in role_list variable from rid to role name.

File

./google_tag.install, line 130
Provides install, update, and uninstall functions.

Code

function google_tag_update_7101(&$sandbox) {
  $roles = user_roles();
  $old_values = variable_get('google_tag_role_list', array());
  $new_values = array();
  foreach ($old_values as $rid => $old_value) {
    $role_name = $roles[$rid];
    $new_values[$role_name] = $old_value ? $role_name : $old_value;
  }
  variable_set('google_tag_role_list', $new_values);
  return t('Converted @count role IDs to role names in google_tag_role_list variable', array(
    '@count' => count($old_values),
  ));
}