You are here

function language_access_enable in Language access 7

Implementation of hook_enable().

File

./language_access.install, line 6

Code

function language_access_enable() {

  // Create array to store all enebled languages
  $languages = language_list('enabled');
  $enabled_languages = array();
  foreach ($languages[1] as $language) {
    array_push($enabled_languages, 'access language ' . $language->language, 'create language ' . $language->language);
  }

  // Now we allow all roles to access all languages
  $user_roles = user_roles();
  foreach ($user_roles as $role_id => $role) {
    user_role_grant_permissions($role_id, $enabled_languages);
  }
}