You are here

function _panopoly_install_administrator_role in Panopoly 7

Helper function: Assign UID 1 to 'administrator' role.

2 calls to _panopoly_install_administrator_role()
panopoly_install in ./panopoly.install
Implements hook_install().
panopoly_update_7103 in ./panopoly.install
Assign user 1 the "administrator" role.

File

./panopoly.install, line 102
Install, update and uninstall hooks.

Code

function _panopoly_install_administrator_role() {

  // Load the administrator role created through features.
  if ($admin_role = user_role_load_by_name('administrator')) {

    // Assign user 1 the "administrator" role.
    db_merge('users_roles')
      ->key(array(
      'uid' => 1,
      'rid' => $admin_role->rid,
    ))
      ->fields(array(
      'uid' => 1,
      'rid' => $admin_role->rid,
    ))
      ->execute();
  }
}