1 url_alter_test.module url_alter_test_url_outbound_alter(&$path, &$options, $original_path)

Implements hook_url_outbound_alter().

File

core/modules/simpletest/tests/url_alter_test.module, line 53
Module to help test hook_url_inbound_alter() and hook_url_outbound_alter().

Code

function url_alter_test_url_outbound_alter(&$path, &$options, $original_path) {
  // Rewrite user/uid to user/username.
  if (preg_match('!^user/([0-9]+)(/.*)?!', $path, $matches)) {
    if ($account = user_load($matches[1])) {
      $matches += array(2 => '');
      $path = 'user/' . $account->name . $matches[2];
    }
  }
}