You are here

function commons_misc_install in Drupal Commons 7.3

Implements hook_install().

File

modules/commons/commons_misc/commons_misc.install, line 10
Update hooks for commons_misc related functions.

Code

function commons_misc_install() {

  // While the administrator role will be created by Features, it will not be
  // available yet when hook_install() is run, so we need to test for and create
  // it here.
  if (!($role = user_role_load_by_name('administrator'))) {
    $role = new stdClass();
    $role->name = 'administrator';
    $role->weight = 10;
    user_role_save($role);
  }

  // Grant user 1 the 'administrator' role.
  user_multiple_role_edit(array(
    1,
  ), 'add_role', $role->rid);

  // Set the 'administrator' role as the 'administrator role'.
  variable_set('user_admin_role', $role->rid);
}