You are here

function login_destination_install in Login Destination 7

Implements hook_install().

File

./login_destination.install, line 81
Install, update and uninstall functions for the Login Destination module.

Code

function login_destination_install() {

  // Update the alter option of 'user/logout' to TRUE,
  // (menu_save invokes necessary hooks).
  $result = db_query("\n    SELECT mlid, menu_name\n    FROM {menu_links}\n    WHERE link_path = 'user/logout' OR link_path = 'user/login' OR  link_path = 'user'\n    ORDER BY mlid ASC");
  foreach ($result as $res) {
    $item = menu_link_load($res->mlid);
    $item['options']['alter'] = TRUE;
    db_update('menu_links')
      ->fields(array(
      'options' => serialize($item['options']),
    ))
      ->condition('mlid', $item['mlid'])
      ->execute();
  }
}