You are here

function rename_admin_paths_url_outbound_alter in Rename Admin Paths 7

Same name and namespace in other branches
  1. 7.2 rename_admin_paths.module \rename_admin_paths_url_outbound_alter()

Implements hook_outbound_alter().

File

./rename_admin_paths.module, line 59
Allows users to rename admin paths

Code

function rename_admin_paths_url_outbound_alter(&$path, &$options, $original_path) {

  // Admin path
  if (variable_get('rename_admin_path', NULL)) {
    $rename_admin_path_value = variable_get('rename_admin_path_value', 'backend');

    // Replace admin in path
    if (preg_match('|^admin(/{0,1}.*)|', $path, $matches)) {
      $path = urlencode($rename_admin_path_value) . $matches[1];
    }
  }

  // user path
  if (variable_get('rename_user_path', NULL)) {
    $rename_user_path_value = variable_get('rename_user_path_value', 'member');

    // Replace user in path
    if (preg_match('|^user(/{0,1}.*)|', $path, $matches)) {
      $path = urlencode($rename_user_path_value) . $matches[1];
    }
  }
}